We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18209
    • 15 Posts
    Hi, I have several pages which first displays some information of a volleybal team (players, schedule, results) and then a Ditto call for all the "news", at the bottom of the page.

    Problem: When I enable pagination and click the next, previous or one of the page links, it will reload the page to the top of the page.... and viewers have to scroll down the page to view the newly loaded ditto results

    Is there any way (I haven’t found yet) I could ad an #anchor to the link-url of the pagination links.... so it will jump after reloading the page to this anchor????

    I’m also using templates for the next and previous links.... which I can use to add this anchor. However I cant find this for the page-numbered links....

    Maybe (if it doesn’t exists) a parameter should be added called "paginateAnchor" which will add an anchor to all the pagination links?

    Ditto call I’m using:
    [[Ditto? &id=`nieuwsarchief` &tpl=`paginaSamenvatting` &display=`5` &orderBy=`pub_date DESC` &showInMenuOnly=`1` &paginate=`1` &tplPaginatePrevious=`ditto_vorige` &tplPaginateNext=`ditto_volgende` &extenders=`summary` &truncText=`lees verder...` &noResults=`Geen nieuws bekend`]]
    [+phx:if=`[+nieuwsarchief_total+]`:is=`0`:then=``:else=`
    Berichten [+nieuwsarchief_start+] t/m [+nieuwsarchief_stop+] van [+nieuwsarchief_total+]    ‖    Pagina [+nieuwsarchief_currentPage+] van [+nieuwsarchief_totalPages+]    ‖    [+nieuwsarchief_previous+] [+nieuwsarchief_pages+] [+nieuwsarchief_next+]`+]


    The tpl for the next link:
    <a href='[+url+]#nieuws' class='ditto_next_link'>Volgende <b style="color: #333357;">»</b></a>


    any thoughts/help appreciated!
      • 18209
      • 15 Posts
      I finally found that you CAN use a template for the pagination numbered links grin.....so problem SOLVED.... (sorry for not finding it sooner)

      now I have 3 seperate chunks to get it to work, and have to make other chunks to make it word for a different anchor.... so would still maybe make a nice addition to ditto...
        • 27762
        • 1 Posts
        Hi,
        Can you explain in details how can you solve the problem? huh
        Please post the code.
          • 18209
          • 15 Posts
          In detail, hopefully understandably wink
          <a name='nieuws'></a>
           [[Ditto? &id=`nieuwsarchief` &tpl=`paginaSamenvatting` &display=`5` &orderBy=`pub_date DESC` &showInMenuOnly=`1` &paginate=`1` &tplPaginatePrevious=`ditto_vorige` &tplPaginateNext=`ditto_volgende` &tplPaginatePage=`ditto_pagina` &extenders=`summary` &truncText=`lees verder...` &noResults=`Geen nieuws bekend`]]
          Berichten [+nieuwsarchief_start+] t/m [+nieuwsarchief_stop+] van [+nieuwsarchief_total+]  ‖ Pagina [+nieuwsarchief_currentPage+] van [+nieuwsarchief_totalPages+] ‖ [+nieuwsarchief_previous+] [+nieuwsarchief_pages+] [+nieuwsarchief_next+]

          I have pagination, so the Ditto call is uncached. I have another (uncached) Ditto call, so for pagination to work, I’ve added an &id=`` to the paginated Ditto call (‘nieuwsarchief’). The placeholders for pagination therefore have this ID in the placeholder name (so that it works for that particular Ditto call). If you have only one Ditto call on the page the id parameter is not neccisary, and instead of [+nieuwsarchief_next+], just use [+next+]...

          Then turn pagination on with &pagination=`1`, and add &tplPaginatePrevious=``, &tplPaginateNext=`` and &tplPaginatePage=`` to use chunks as a template for the pagination links (so fill them with the name of your chunks, otherwise I think the links will not show at all!).
          For these three parameters, make 3 separate chunks, I have:
          Chunk: ditto_vorige
          <a href='[+url+]#nieuws'>Vorige</a>

          Chunk: ditto_volgende
          <a href='[+url+]#nieuws'>Volgende</a>

          Chunk: ditto_pagina
          <a href='[+url+]#nieuws'>[+page+]</a>

          Of course you can name the chunks and the ditto call ID anything you would like…. Mine are in Dutch so….
          In the chunks, I’ve added the name of the anchor (<a name="nieuws"></a>) I’ve placed at the top of the Ditto call, to the links in the chunk.
          Now instead of the default template for the paginations links, it will use your new chunks, with the anchor added named ’nieuws’ in my case…. (name of anchor you can change also of course).

          I’m using the ’nieuws’ anchor for all my paginated ditto calls, but if you want to use two different ditto calls on 1 page, you’ll need to make a different set of chunks with a different anchor(name).

          Nice overview of Ditto parameters: http://ditto.modxcms.com/files/snippet-ditto-php.html
          and of pagination: http://ditto.modxcms.com/tutorials/pagination.html