Welcome to TalkGraphics.com
Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Hybrid View

  1. #1
    Join Date
    Oct 2010
    Location
    Northern California
    Posts
    47

    Default Re: Is there a Search function for a site?

    Well, I finally made some progress, but could use a tip from a programmer.

    I put the search function at the top of my fan site, and it does work, but it works too well. It finds and returns every instance of the words even in the code. Which means that it will pull up pages with the term as a keyword or part of a menu option. If I enter "Spartacus" for instance, all the pages in my site get shown.

    So what I get is the same as if I entered: site:stanleykubrick.website spartacus

    But if I manually enter: site:stanleykubrick.website intitle:spartacus, which added the operator "intitle", it now gives me only pages with the word "Spartacus" as part of the title. That would work much better for my site. Is there some extra coding that I could add to my existing code to do that? The code I have now is:

    <form method="get" action="http://www.google.com/search">

    <div style="border:2px dotted black;padding:4px;width:15em;">
    <table border="0" align="center" cellpadding="0">
    <tr><td>
    <input type="text" name="spartacus" size="25" style="color:#808080;"
    maxlength="255" value="Google site search"
    onfocus="if(this.value==this.defaultValue)this.val ue=''; this.style.color='black';" onblur="if(this.value=='')this.value=this.defaultV alue; "/>

    <input type="submit" value="Go!" />
    <input type="hidden" name="sitesearch" value="stanleykubrick.website" /></td></tr>
    </table>
    </div>

    Thanks.

  2. #2
    Join Date
    Aug 2000
    Location
    Placitas, New Mexico, USA
    Posts
    41,523

    Default Re: Is there a Search function for a site?

    Acorn came up with one a few years back. I am attaching a simple Xara .xar document that contains a placeholder that you can copy and paste onto your .web or .xar document. Just change the URL www.placitasartists.com link with your own site URL.

    If you like it and use it, be sure to thank Acorn (moderator here).

    Click on the link above to see the search in action. Do a search for Painting, or Priester and anything else.
    Attached Files Attached Files

  3. #3
    Join Date
    Oct 2010
    Location
    Northern California
    Posts
    47

    Default Re: Is there a Search function for a site?

    Unfortunately it didn't work either. All it changed was adding WWW in front of the site name, but which oddly gave me no results at all. I think I need the code to specify "intitle:" with the search term. But thanks for finding that alternative code.

  4. #4
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,903

    Default Re: Is there a Search function for a site?

    Here is the code that you would modify to get Gary's example to work as you need:

    <script type="text/javascript">
    //Enter domain of site to search.
    var domain="http://stanleykubrick.website" //replace this with your site domain


    function GoogleSiteSearch(cur){
    cur.q.value="site:"+domain+" intitle:"+cur.searchTerm.value
    }
    </script>


    <form action="http://www.google.com/search" method="get" target="_blank" onSubmit="GoogleSiteSearch(this)">
    <p><br /> <!--replace [[...]] with your details -->
    <input id="searchBox" name="searchTerm" type="text" style="width: 192px" /> <input type="submit" value="?" /></p>
    <input name="q" type="hidden" />
    </form>

    I would probably add a drop-down box to force include specific operators in http://www.googleguide.com/advanced_...reference.html like intitle:, rather that hard-code it.

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  5. #5
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,903

    Info Re: Is there a Search function for a site?

    for those of who prefer Google not to track us too much, I would use;

    <script type="text/javascript">
    //Enter domain of site to search.
    var domain="http://stanleykubrick.website" //replace this with your site domain


    function SiteSearch(cur){
    cur.q.value="site:"+domain+" intitle:"+cur.searchTerm.value
    }
    </script>


    <form action="http://duckduckgo.com" method="get" target="_blank" onSubmit="SiteSearch(this)">
    <p><br /> <!--replace [[...]] with your details -->
    <input id="searchBox" name="searchTerm" type="text" style="width: 192px" /> <input type="submit" value="?" /></p>
    <input name="q" type="hidden" />
    </form>

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  6. #6
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,938

    Default Re: Is there a Search function for a site?

    Excellent Acorn
    Egg

    Minis Forum UM780XTX AMD Ryzen7 7840HS with AMD Radeon 780M Graphics + 32 GB Ram + MSI Optix Mag321 Curv monitor
    + 1Tb SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  7. #7
    Join Date
    Oct 2010
    Location
    Northern California
    Posts
    47

    Default Re: Is there a Search function for a site?

    It worked! Thanks. It pulled up only pages that had the search term in the title. But like a typical newbie, I then realized that people might also search for words not part of the film name, and that I had now excluded everything else. So I ended up going full circle by just using the WD widget for Google search.

    Since this is my own fan site, no harm done and the time spent was a learning experience. I actually only do fan-type sites like this for myself, and have never done a site for anyone else besides my wife, since WD makes them simple. I really appreciate the feedback and solution.

  8. #8
    Join Date
    Nov 2002
    Location
    Tennessee
    Posts
    306

    Default Re: Is there a Search function for a site?

    This is certainly cool, but I do not like the fact that the results take you out and away from the page you were searching from and not truly built in to the page you were trying to navigate through.
    Oh well,...you can't have it all now can you? STILL,... it did work.

  9. #9
    Join Date
    Apr 2012
    Location
    SW England
    Posts
    17,903

    Default Re: Is there a Search function for a site?

    Quote Originally Posted by TDolce View Post
    This is certainly cool, but I do not like the fact that the results take you out and away from the page you were searching from and not truly built in to the page you were trying to navigate through.
    Oh well,...you can't have it all now can you? STILL,... it did work.
    With a sleight of hand you can embed the search page results into a Placeholder if you wanted to have a specific search page. You could make the search result open a new page so you do not lose the current breadcrumb.

    Go one better. Build a concordance of your key words or phrase across the site with the page title and design in some JavaScript magic to deliver autocompleting of a word or phrase. This probably needs to be a Dear Xara...

    Acorn
    Acorn - installed Xara software: Cloud+/Pro+ and most others back through time (to CC's Artworks). Contact for technical remediation/consultancy for your web designs.
    When we provide assistance, your responses are valuable as they benefit the community. TG Nuggets you might like. Report faults: Xara Cloud+/Pro+/Magix Legacy; Xara KB & Chat

  10. #10
    Join Date
    May 2002
    Location
    Canada
    Posts
    3,345

    Default Re: Is there a Search function for a site?

    Acorn, I would appreciate when you get a min to show us how to get the results showing within the website itself. Thank you so much my wizard.

 

 

Tags for this Thread

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
  •