We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25067
    • 5 Posts
    I’m trying to use Ditto to create pagination for a group of pages where I want ditto to display one entire page at a time but where you can navigate through the group of pages using the pagination.

    Ditto version 2.1.0 with modx 1.0.2

    I’ve got this working using the [+content+] placeholder in my artistContent chunk (&tpl=`artistContent`) as long as there are no TVs in the content.

    However, when I try and use TVs to replace any of the "hard coded" html (for client ease of use) in the content section of the target pages the TVs just seem to get ignored. I tried switching the TVs from [*tvName*] to [+tvName+] in my target page’s resource content section but that doesn’t help. If I leave the TV as [*tvName*] and add the TV to the container where the Ditto call is executed then the TV is parsed properly but of course that doesn’t help me because I need the TV from each target page.

    Ditto call from the container of the group of pages:
    [!Ditto? &parents=`[*id*]` &tpl=`artistContent` &noResults=`DittoNoResults` &orderBy=`pagetitle ASC` &display=`1` &paginate=`1` &paginateAlwaysShowLinks=`1`!]
    <p>[*pagetitle*] | Page <strong>[+currentPage+]</strong> of <strong>[+totalPages+]</strong> </p> <div id="ditto_pages"> [+previous+] [+pages+] [+next+] </div> 


    artistContent chunck:
    [+content+]


    HTML from resource content with TVs (when hard coded page displays properly):
    <script type="text/javascript" src="assets/js/slimbox2.js"></script>
    <div id="centerwrapper">
    <div id="box1">
            <a href="[+image1+]" rel="lightbox" title='[+caption1+]'><img width="[+img1w+]" height="[+img1h+]" src="[+image1+]"/></a>
    	<p>[+caption1+]</p>
    </div>


    I’ve tried turning off the page caching for both the target page and the container but neither helped.

    I’ve also tried adding in PHx (2.1.3) because of some posts I’ve read, which broke pagination until I got the cached and uncached calls and pages tweaked correctly, but TVs still didn’t get parsed, do I need to do something besides just install and enable PHx for it to help??

    I really hope I’m just overlooking something simple that will get this to work.

    Any suggestions are welcome, I’ve got a deadline coming up and just can’t figure out why this won’t work!! If Ditto is not the right way to do this please let me know.

    Thanks,

    -Paul
      • 25067
      • 5 Posts
      Update:

      Upon more research I found a reference to using &hiddenFields=`tvName` when using PHx with Ditto so, I tried adding &hiddenFields=`image1` (one of my TVs not being parsed) and what do you know, now the TV is being parsed and showing up in the page!

      However, I have like 40 TVs that aren’t being parsed in content so, is my only option to have a hiddenFields parameter with 40 TVs listed?

      Any suggestions?

      Thanks,

      -Paul
        • 26931
        • 2,314 Posts
        ...hope i undestood you right smiley why are you putting your template code in the [*content*]/[+content+] field, and the content field in the chunk? you could easily use a chunk "artistContent" for your Ditto template code, no need to place [+content+] in your chunk
          • 25067
          • 5 Posts
          I think I understand what you are asking...to verify, let me provide the background.

          I have multiple pages of custom layouts for artwork from a specific artist so, that requires each page to have its own CSS file and corresponding HTML in the content section. I am then grouping those pages by artist with Ditto and trying to use Ditto’s pagination so, a user can browse through all the pages of one artist.

          Now, if the pages didn’t require a custom layout I could have the HTML that is in the content section of each resource in a chunk which Ditto then calls as its output, unfortunately each page requires custom HTML so, that leaves me with calling Ditto and outputting the custom [+content+] of each resource page. So, it really isn’t the template code that is in the content field but the HTML that is used to display each individual resource page. Am I making sense yet...

          I’ve also just found out that I can skip using a chunk altogether and use
          &tpl=`@CODE:[+content+]`
          instead.

          That does makes things a bit cleaner but didn’t help with the TVs being parsed.

          So, now I’ve got everything working by using the "hiddenFields" parameter in Ditto but I had to list all 45 of my TVs so, my ditto call is a bit ridiculous and I figure there has got to be a better way! So, I’m hoping somebody can point me in a better direction.

          Thanks,

          -Paul