We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15871
    • 105 Posts
    http://printspiration.com

    I have the main search in the header and it is available on all pages. Here is the call:
    [!AjaxSearch? &ajaxSearch=`0` &AS_showResults=`0` &AS_landing=`8`  !]
    


    I have also created custom templates for the layout and results and paging. Here they are:
    <!-----------------template.tpl----------------------->
    [+as.showForm:is=`1`:then=`
    <form [+as.formId+] action="[+as.formAction+]" method="post">
        <div class="search">
            <label>Search</label>
            <span><input id="ajaxSearch_input" class="cleardefault" type="text" name="search" value="[+as.inputValue+]"[+as.inputOptions+] /></span>
            <input id="ajaxSearch_submit" type="image" src="assets/templates/printspiration/images/btn-search.gif" alt="Search" name="search" value="[+as.inputValue+]"[+as.inputOptions+]  />
        </div>
    </form>
    `+]
    [+as.showIntro:is=`1`:then=`
    <p class="ajaxSearch_intro" id="ajaxSearch_intro">[+as.introMessage+]</p>
    `+]
    [+as.showResults:is=`1`:then=`
    [+as.results+]
    `+]
    
    <!-----------------Paging.tpl----------------------->
    [+as.tpl:is=`paging`:then=`
      <span class="ajaxSearch_paging">
        [+as.pagingLinks+]
      </span>
    `+]
    [+as.tpl:is=`pagingLinks`:then=`
      <a href="[+as.pagingLink+]" class="ajaxSearch_page">[+as.pagingText+]</a>
    `+]
    [+as.tpl:is=`pagingLinksCurrent`:then=`
      <span class="ajaxSearch_currentpage">[+as.pagingText+]</span>
    `+]
    
    <!-----------------result.tpl----------------------->
     <li>
        <div class="inner">
            <span class="photo"><a href="[+as.resultLink+]" title="[+as.longtitle+]"><img src="assets/pageimgs/[+as.id+]/category-img.jpg" alt="[+as.longtitle+]" width="174" height="174" /></a></span>
            <span class="btm"> </span>
            <strong><a href="[+as.resultLink+]">[+as.pagetitle+]</a></strong>
            <span>[+as.design_firm:ne=``:then=`[+as.design_firm+]`+]</span>
        </div>
        <div class="btm"> </div>
    </li>
    
    <!-----------------results.tpl----------------------->
    
    [+as.noResults:is=`1`:then=`
      <div class="[+as.noResultClass+]">
        [+as.noResultText+]
      </div>
    `:else=`
      <p class="ajaxSearch_resultsInfo">[+as.resultInfoText+]</p>
      [+as.paging+]
      <ul class="browsing-list">
      [+as.listResults+]
      </ul>
      [+as.paging+]
    `+]
    


    The first search (from the hompage for example) works. Try searching on "zero"
    But then try and search from the Results page (try "OXO")

    You will see that it now searches on what I have set as the Default text in the Lang file. and does not chnge the search results. The result page is NOT cached.
    $_lang['as_boxText'] = 'What are you looking for?';


    Here is the call on the Results page:
    [!AjaxSearch? &ajaxSearch=`0` &order=`pagetitle` &AS_showForm=`0` &grabMax=`16` &extract=`0`!]
    


    The site using jQuery BTW.

    Thoughts?
      • 5811
      • 1,717 Posts
      You use
      value="[+as.inputValue+]"[+as.inputOptions+]
      twice inside your template:
      <span><input id="ajaxSearch_input" class="cleardefault" type="text" name="search" value="[+as.inputValue+]"[+as.inputOptions+] /></span>
              <input id="ajaxSearch_submit" type="image" src="assets/templates/printspiration/images/btn-search.gif" alt="Search" name="search" value="[+as.inputValue+]"[+as.inputOptions+]  />


      Try:
      <span><input id="ajaxSearch_input" class="cleardefault" type="text" name="search" value="[+as.inputValue+]"[+as.inputOptions+] /></span>
              <input id="ajaxSearch_submit" type="image" src="assets/templates/printspiration/images/btn-search.gif" alt="Search" name="search" value="[+as.submitText+]" />
        • 15871
        • 105 Posts
        @coroico thanks for the reply. I tried it but it didn’t work.

        An odd thing is too tat the search never changes. I doesn’t find ont he search term. It seems to only find the results for the default text. Could the ClearDeafult class have something to do with it?
          • 5811
          • 1,717 Posts
          The submit button (or image sbumit button) should be named "sub", not "search"

          alt="Search" name="sub" value="[+as.submitText+]" />

          Try:
          <span><input id="ajaxSearch_input" class="cleardefault" type="text" name="search" value="[+as.inputValue+]"[+as.inputOptions+] /></span>
                  <input id="ajaxSearch_submit" type="image" src="assets/templates/printspiration/images/btn-search.gif" alt="Search" name="sub" value="[+as.submitText+]" />


          The mess comes from the fact that two input (search & sub) has the same name.
            • 15871
            • 105 Posts
            Yep, works now smiley