Results 1 to 9 of 9
  1. #1

    Multiple search question

    Hello Dave

    Your posts have been so helpful on this subject but I am unsure how to put the two search option into practice.

    This question is in regards to the hints you gave in this thread about search forms

    In my situation I have two searches that I want to display as a dropdown and form.

    One is a library catalog -

    Search string is - http://www.catalog.com/testtesttestKEYWORDtesttesttest

    The other one is for Google -

    Search string is - http://www.google.com/search?q=KEYWORD

    'Keyword' is the search phase.

    As you can see, one is a basic Google url and the other is a catalog URL that is split with a keyword in the middle.
    What code can I use to get mine to display like how your previous example does?

    This is all so new but I am learning quickly but this has me really confused.

    Any help you can give would be greatly appreciated!

    Thanks for all of your help with other threads on this site - I don't know what I'd do without it! Unfortunately, this has me stumped!


  2. #2
    Administrator Dave's Avatar
    Join Date
    Sep 2004
    Location
    Te Awamutu, New Zealand
    Posts
    3,959
    Blog Entries
    79
    Hi Lorelei, thanks for the kind comments.

    Answering your question is going to be a bit of work - I'll have a look into it ASAP. In the meantime could you clarify whether the two instances of "testtesttest" in the catalog URLs are always exactly the same, or do those parts change? Perhaps if you could give a couple of actual examples, that might help me understand what we're dealing with.
    Dave Owen
    MediaCollege.com

  3. #3
    Hi Dave

    Thanks for the response!

    To answer your question, yes - the two instances in the catalog URL will always stay the same.

    From your previous work, I know this setup will work for what I need but... it is just knowing what to put in the function area below...

    Code:
    function dosearch() {
    var which_engine = sf.sengines.options[sf.sengines.selectedIndex].value;
    if (which_engine == "catalog") {
      catalog();
       } else if (which_engine == "google") {
       google();
       } 
    }
    
    function catalog() {
      // code for catalog search
    }
    function googlesearch() {
      // code for google search
    }
    And then.. needing to know what goes into the dropdown.

    Code:
    <select name="search">
    <option>Catalog</option>
    <option>Google</option>
    </select>
    Last edited by Lorelei; 4th Oct 2012 at 13:47.

  4. #4
    Administrator Dave's Avatar
    Join Date
    Sep 2004
    Location
    Te Awamutu, New Zealand
    Posts
    3,959
    Blog Entries
    79
    OK, I've tried a slightly different tack which should be a bit more efficient. Try this and let me know how you get on...

    Script for the document head:

    Code:
    <script type="text/javascript">
    function dosearch() {
      var rest_of_URL = "testtesttest";
      var sf = document.searchform;
      var se = sf.sengines.options[sf.sengines.selectedIndex].value;
      var kw = sf.searchterms.value;
      var submitto = se + kw;
      if (se == "http://www.catalog.com/testtesttest") { submitto += rest_of_URL; }
      window.location.href = submitto;
    }
    </script>
    The search form:

    Code:
    <form name="searchform" onSubmit="return dosearch(); return false;">
    Search:&nbsp;
    <select name="sengines">
    <option value="http://www.catalog.com/testtesttest">Catalog</option>
    <option value="http://www.google.com/search?q=">Google</option>
    </select>
    &nbsp;&nbsp;For:&nbsp;
    <input name="searchterms" type="text" value="">
    <input type="submit" value="Search">
    </form>
    I made a page for this variation here:
    http://www.mediacollege.com/internet...i-search2.html
    As always I'm open to feedback and improvements.
    Dave Owen
    MediaCollege.com

  5. #5
    Hello Dave

    Just to let you know, this worked a TREAT! We are so happy with the new feature and your help was AMAZING. I hope others can make use of this great feature - we've had great success with it since we added it to our site.

    Thanks again Dave - your help was invaluable!!


  6. #6
    Administrator Dave's Avatar
    Join Date
    Sep 2004
    Location
    Te Awamutu, New Zealand
    Posts
    3,959
    Blog Entries
    79
    That's great, I love a happy ending! Thanks for letting me know how it went.

    Now here's a quick plug for ourselves just in case you're able to do us any favours in return
    http://www.mediacollege.com/home/support.html
    Dave Owen
    MediaCollege.com

  7. #7
    New Member
    Join Date
    Dec 2012
    Location
    edo state,nigeria
    Posts
    1
    Good morning sir,i just got into web designing.this site as be of great help to me for close to two years and i have fallen in love with it,thanks.
    i am working on a project now and am using a multiple search option,
    first,how can i use the multiple search option with adsense
    and can i apply a URL e.g mediacollege.com so that it will search only the content of mediacollege.com
    and another option with url like mediacollege.com/video/ and it will search only whats on that segment.
    i saw it on website,u can check it out if u dont understand my question http://multiply.com you will see a market place with the categories in a drop down multiply search option.
    thanks,i will be waiting for ur reply

  8. #8

  9. #9
    Administrator Dave's Avatar
    Join Date
    Sep 2004
    Location
    Te Awamutu, New Zealand
    Posts
    3,959
    Blog Entries
    79
    ejiro, I'm not quite sure what you mean by wanting to make it work with Adsense - do you mean Adsense for Search? If so, the news is bad. Google doesn't allow you to modify the code in any way - you're stuck with what they give you. We have the same problem here at MediaCollege.com which is why our site search is divided into three different pages.

    To search a particular site with Google, use the following syntax (in this case, search mediacollege.com for "Dave"):

    https://www.google.co.nz/search?q=si...llege.com+Dave
    Dave Owen
    MediaCollege.com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Subscribe to us on YouTube