Google Search - Code modification

Discussion in 'AdSense' started by Sanbon, Aug 4, 2008.

  1. #1
    Hey guys, I have been a lurker on this site for the last couple months. I now have a question so I decided to register.

    I just put Google search on my site which is for the most part just a forum. The only way I could get the search code to behave how I wanted to was to add <div style="float:right"> inside the code. Is this against the ToS? Here is what my code looks like: (I bolded the code I added)

    <!-- Begin Search Code -->
    <style type="text/css">
    @import url(http://www.google.com/cse/api/branding.css);
    </style>
    [B]<div style="float:right">[/B]
    <div class="cse-branding-right" style="background-color:#000000;color:#FFFFFF">
      <div class="cse-branding-form">
        <form action="http://www.google.ca/cse" id="cse-search-box" target="_blank">
          <div>
            <input type="hidden" name="cx" value="partner-pub-MY ID # Was here" />
            <input type="hidden" name="ie" value="ISO-8859-1" />
            <input type="text" name="q" size="25" />
            <input type="submit" name="sa" value="Search" />
          </div>
    
        </form>
      </div>
      <div class="cse-branding-logo">
        <img src="http://www.google.com/images/poweredby_transparent/poweredby_000000.gif" alt="Google" />
      </div>
      <div class="cse-branding-text">
        Custom Search
      </div>
    </div>
    [B]</div>[/B]
    
    <!-- End Search code -->
    
    Code (markup):
    Is there another way to get the code to behave how it is right now? If I take out that code I get a horrifically long black box that goes from one side of my site to the other (22 inch monitor FTW :)). And when I put the float code on the out side of the script only the "Custom Search" and the Google logo move to the right while the search box stays on the left.

    PS the location of this search box is at www.kelownacivics.com/forum
     
    Sanbon, Aug 4, 2008 IP
  2. timallard

    timallard Well-Known Member

    Messages:
    1,634
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    158
    #2
    If you add the div outiside the script tag it should work the same..no?
    ..then you wont be modifying search code, which is against ToS.

    if your getting the black line you may need to create some custom classes.
     
    timallard, Aug 4, 2008 IP
  3. Sanbon

    Sanbon Peon

    Messages:
    31
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hmmmm.... I just changed the code to this and it appears to be working. I could have sworn I did it like this yesterday and it didn't.

    <!-- Begin Search Code -->
    [COLOR="Red"]<div style="float:right">[/COLOR]
    <style type="text/css">
    @import url(http://www.google.com/cse/api/branding.css);
    </style>
    <div class="cse-branding-right" style="background-color:#000000;color:#FFFFFF">
      <div class="cse-branding-form">
        <form action="http://www.google.ca/cse" id="cse-search-box" target="_blank">
          <div>
            <input type="hidden" name="cx" value="partner-pub-6962187141594874:uvq8jcfwjz0" />
            <input type="hidden" name="ie" value="ISO-8859-1" />
            <input type="text" name="q" size="25" />
            <input type="submit" name="sa" value="Search" />
          </div>
        </form>
      </div>
      <div class="cse-branding-logo">
        <img src="http://www.google.com/images/poweredby_transparent/poweredby_000000.gif" alt="Google" />
      </div>
      <div class="cse-branding-text">
        Custom Search
      </div>
    </div>
    [COLOR="Red"]</div>[/COLOR]
    <!-- End Search code -->
    Code (markup):

    Is this better? Is it going to violate the ToS?
     
    Sanbon, Aug 4, 2008 IP
  4. timallard

    timallard Well-Known Member

    Messages:
    1,634
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    158
    #4

    Technically its still breaking ToS, but since what is above and below it are just comment tags, it should make no difference if you move the div outside of it, test it out, let me know.

    -Tim
     
    timallard, Aug 4, 2008 IP
  5. Sanbon

    Sanbon Peon

    Messages:
    31
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I put the comment tags in there so I could find the code more easily. I can remove them if you think its a violation.

    The way it is in the 2nd post seams to be working as I'd like it to. You still think it violates the ToS? How should I do it so it doesn't?
     
    Sanbon, Aug 4, 2008 IP
  6. timallard

    timallard Well-Known Member

    Messages:
    1,634
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    158
    #6
    
    <!-- GOOGLE SEARCH CODE CONTAINER -->
    [COLOR="Red"]<div style="float:right">[/COLOR]
    <!-- Begin Search Code -->
    <style type="text/css">
    @import url(http://www.google.com/cse/api/branding.css);
    </style>
    <div class="cse-branding-right" style="background-color:#000000;color:#FFFFFF">
      <div class="cse-branding-form">
        <form action="http://www.google.ca/cse" id="cse-search-box" target="_blank">
          <div>
            <input type="hidden" name="cx" value="partner-pub-6962187141594874:uvq8jcfwjz0" />
            <input type="hidden" name="ie" value="ISO-8859-1" />
            <input type="text" name="q" size="25" />
            <input type="submit" name="sa" value="Search" />
          </div>
        </form>
      </div>
      <div class="cse-branding-logo">
        <img src="http://www.google.com/images/poweredby_transparent/poweredby_000000.gif" alt="Google" />
      </div>
      <div class="cse-branding-text">
        Custom Search
      </div>
    </div>
    <!-- End Search code -->
    [COLOR="Red"]</div>[/COLOR]
    <!--END GOOGLE SEARCH CODE CONTAINER -->
    Code (markup):

    Simply wrap another comment around it, that way you dont touch their code.
     
    timallard, Aug 4, 2008 IP
  7. Sanbon

    Sanbon Peon

    Messages:
    31
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    The <!-- Begin Search Code --> and <!-- End Search code --> are already my own comments. They're not part of the Google Search code. Sorry for any confusion. <style type="text/css"> is the beginning of the Google code. So I should be good??


    And thanks a lot for your help!!
     
    Sanbon, Aug 4, 2008 IP
  8. timallard

    timallard Well-Known Member

    Messages:
    1,634
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    158
    #8
    Good to go :) No problem, glad to help.
     
    timallard, Aug 4, 2008 IP
  9. Abhik

    Abhik ..:: The ONE ::..

    Messages:
    11,337
    Likes Received:
    606
    Best Answers:
    0
    Trophy Points:
    410
    Digital Goods:
    2
    #9
    In that case, Its OK with TOS.. Otherwise, the first code you mentioned was clearly breaking TOS.
     
    Abhik, Aug 4, 2008 IP