We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7527
    • 437 Posts
    I have set my pagination on most pages using a template code that works with getPage and the &pageNavVar=`page.nav` parameter. AdvSearch does not seem to support this parameter and I am struggling to integrate it. I currently use this set up:

    page ActiveTpl = <li class="current"><strong>[[+pageNo]]</strong></li>
    PageNavOuterTpl = [[+first]][[+prev]][[+pages]][[+next]][[+last]]
    PageNavTpl = <li><a href="[[+href]]" title="[[+pageNo]]">[[+pageNo]]</a></li>
    PageNextTpl = <li><a href="[[+href]]">Next »</a></li>
    PagePrevTpl = <li><a href="[[+href]]">« Prev</a></li>

    This question has been answered by iusemodx. See the first response.

      www.PawsForWildlife.co.uk
      www.Borntobrick.co.uk
      • 13226
      • 953 Posts
      Can you post the original parameters used by that snippet ?

      Or post a link to any tutorial that uses that snippet, specifically where the templates are
        • 7527
        • 437 Posts
        This is the template code for the results pagination.

        [[+advsearch.total:gt=`1`:then=`
        <span class="advsea-current"> Results [[+advsearch.first]] - [[+advsearch.last]] of [[+advsearch.total]] </span>
        `]]
        [[+advsearch.nextlink:isnot=``:then=`<span class="advsea-next">
            <a href="[[+advsearch.nextlink]]">[[%advsearch.next? &namespace=`advsearch` &topic=`default`]]</a>
        </span>`]]
        [[+advsearch.previouslink:isnot=``:then=`<span class="advsea-previous">
            <a href="[[+advsearch.previouslink]]">[[%advsearch.previous? &namespace=`advsearch` &topic=`default`]]</a>
        </span>`]]


        My call for the landing page snippet:

        [[!AdvSearch? &perPage=`10` &withFields=`pagetitle,introtext,content,longtitle` &fields=`pagetitle,introtext,content,longtitle` &tpl=`AdvSearchResult` &hideMenu=`2` &highlightTag=`bold` &highlightResults=`1` &extractLength=`600`]]


          www.PawsForWildlife.co.uk
          www.Borntobrick.co.uk
          • 13226
          • 953 Posts
          Am guessing again:

          Templates:
          [[+advsearch.total:gt=`1`:then=`<li class="pages"><strong>Results [[+advsearch.first]] - [[+advsearch.last]] of [[+advsearch.total]]</strong></li>`]]
          
          [[+advsearch.nextlink:isnot=``:then=`<li><a href="[[+advsearch.nextlink]]">[[%advsearch.next? &namespace=`advsearch` &topic=`default`]]</a></li>`]]
          
          [[+advsearch.previouslink:isnot=``:then=`<li><a href="[[+advsearch.previouslink]]">[[%advsearch.previous? &namespace=`advsearch` &topic=`default`]]</a></li>`]]


          Landing page:
          <nav class="pagination">
            <ul>
              [[!AdvSearch? &perPage=`10` &withFields=`pagetitle,introtext,content,longtitle` &fields=`pagetitle,introtext,content,longtitle` &tpl=`AdvSearchResult` &hideMenu=`2` &highlightTag=`bold` &highlightResults=`1` &extractLength=`600`]]
            </ul>
          </nav>
            • 7527
            • 437 Posts
            It's almost there I think. The results chunk 'AdvSearchResult' I have styled as this:

            <div class="post-wrapper">
                    <div class="post-title clear">
                      <div class="post-heading"> <h3>[[+advsearch.idx]]. <a href="[[+advsearch.link:is=``:then=`[[~[[+advsearch.id]]]]`:else=`[[+advsearch.link]]`]]" title="[[+advsearch.longtitle]]">[[+advsearch.pagetitle]]</a></h3></div></div>
                      
                    
                    <div class="post-content post-excerpt">[[+advsearch.extracts]]
                    </div>
                    <div class="post-read"><a class="more-link" [[+advsearch.link]]">Read the rest of this entry »</a>
             </div></div>


            the default `Paging1` template now has this code:

            [[+advsearch.total:gt=`1`:then=`<li class="pages"><strong>Results [[+advsearch.first]] - [[+advsearch.last]] of [[+advsearch.total]]</strong></li>`]]
             
            [[+advsearch.nextlink:isnot=``:then=`<li><a href="[[+advsearch.nextlink]]">[[%advsearch.next? &namespace=`advsearch` &topic=`default`]]</a></li>`]]
             
            [[+advsearch.previouslink:isnot=``:then=`<li><a href="[[+advsearch.previouslink]]">[[%advsearch.previous? &namespace=`advsearch` &topic=`default`]]</a></li>`]]


            And I have chnaged the call on my search landing page to :

            <nav class="pagination">
              <ul>
                [[!AdvSearch? &perPage=`10` &withFields=`pagetitle,introtext,content,longtitle` &fields=`pagetitle,introtext,content,longtitle` &tpl=`AdvSearchResult` &hideMenu=`2` &highlightTag=`bold` &highlightResults=`1` &extractLength=`600`]]
              </ul>
            </nav>


              www.PawsForWildlife.co.uk
              www.Borntobrick.co.uk
              • 7527
              • 437 Posts
              I gives all the correct results and pagination now, however the title and 'read the rest of the entry' links are enclosed inside a green bar. The read the rest entry is also not an 'a' link it renders as pure text? I guess the only way to remedy is to amend the CSS as it is all wrapped within the <nav pagination>
                www.PawsForWildlife.co.uk
                www.Borntobrick.co.uk
              • discuss.answer
                • 13226
                • 953 Posts
                I don't know the snippet and don't want to step on feet, but:

                Results, should in my opinion be seperated from the paginated navigation

                Meaning, something like:
                <div class="results">
                Result 1
                Result 2
                </div>
                <div class="pagination">
                Paginated nav
                </div>

                There shouldn't be a need to modify an original design to fir the results into it - it should be the opposite, that's what the templates are there for

                At the moment I can't help further, I will have to look into this further when I have more time
                  • 7527
                  • 437 Posts
                  Ok thank you. I will have a look and see if I can work something out.
                    www.PawsForWildlife.co.uk
                    www.Borntobrick.co.uk
                    • 7527
                    • 437 Posts
                    Aha, sorry there is a third chunk 'AdvSearchResults'. I have amended it to:

                    <div class="advsea-results-list">
                        [[+advsearch.results]]
                    </div>
                    <nav class="pagination">
                      <ul>
                    
                    <div class="advsea-paging[[+advsearch.pagingType]]">[[+advsearch.paging]]</div>
                     </ul>
                    </nav>


                    And it works. As you quite rightly said the results are kept seperate from the navigation. Thank you
                      www.PawsForWildlife.co.uk
                      www.Borntobrick.co.uk
                      • 13226
                      • 953 Posts
                      You can't use this:
                      <nav class="pagination">
                        <ul>
                          <div class="advsea-paging[[+advsearch.pagingType]]">[[+advsearch.paging]]</div>
                        </ul>
                      </nav>


                      As the div is not technically allowed in that position.

                      I would suggest using the following:
                      [[+advsearch.results]]
                      <nav class="pagination">
                        <ul>
                          [[+advsearch.paging]]
                        </ul>
                      </nav>


                      You don't need to use the "advsea-results-list" wrapping element in your template, as the results don't need the wrapper and they are coded using the result chunk