Announcement

Collapse
No announcement yet.

adding search phrase to results page

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    adding search phrase to results page

    Had a good look around but cant find the answer to this one, must be possible though?

    I want to be able to add the search phrase entered in to the results pageso people can see what they've searched on, cant see a variable to use...
    seo company: web development - online marketing - actinic ecommerce

    #2
    Cookies will do this.

    Add some code to your search box's FORM tag.

    For the simple search box, replace
    Code:
    <form name="simplesearch" method="get" action="<actinic:variable name="OnlineScriptURL" value="Search Script URL" />">
    with
    Code:
    <form name="simplesearch" method="get" action="<actinic:variable name="OnlineScriptURL" value="Search Script URL" />"
      onsubmit="setCookie('searchstring',this.SS.value);return true;">
    And for the full search page, replace
    Code:
    <form method="get" action="<actinic:variable name="OnlineScriptURL" value="Search Script URL" />">
    with
    Code:
    <form method="get" action="<actinic:variable name="OnlineScriptURL" value="Search Script URL" />" 
      onsubmit="setCookie('searchstring',this.SS.value);return true;">
    Finally, in your search results where you want to display the info put
    Code:
    <script>document.write(getCookie('searchstring'));</script>
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Many thanks Norman - I'll give that one a go
      seo company: web development - online marketing - actinic ecommerce

      Comment


        #4
        that seems to work ok Norman but my reason for doing this is so that search engines will index the results pages as we have anchor text links off the home page to pre-defined search results pages.

        If we can put the search phrase into the page title and h1 tags this will help in terms of SEO - your code works but is not visible to search engines as when viewing the source I see the javascript!

        Sorry should have explained this - maybe using PHP or another method - may need a perl script mod?
        seo company: web development - online marketing - actinic ecommerce

        Comment


          #5
          Hi, I have implemented the code Norman has posted so as to be able to display the term that has been searched on in the search results page e.g. "Search results for SearchString. You can see an example of what I mean by visiting www.designtoplease.co.uk and using either the simple or advanced search option.

          I was jsut wondering if there is a way to use this method to also display the term searched on in the keyword search box so that if a user mispells the term they just need to correct it in the search box rather than having to retype the whole term. I thought this might be possible by adding a value tag to the search input box e.g.

          Code:
           <input type="text" name="SS" size="25" value="<script>document.write(getCookie('searchstring'));</script>"/>
          but this just appears to show the script code in the value box rather than the term itself. Does anyone know if it is possible to acheive this?

          Also is there a way to only allow the script to work if a value is entered into the search box - the reason I ask is because if someone uses the advanced search page and just chooses to search via price or category but without entering a specific search term it currently results in showing "Search results for undefined" - its not a big issue but would look a little tidier if could leave this blank if someone has chosen not to enter a term.

          Kind Regards
          Jon
          www.designtoplease.co.uk
          www.getmeoutofahole.com
          www.toys4james.co.uk
          Located in Herts

          Comment

          Working...
          X