0

I'm having difficulty getting the pagination functionality working with [[Ditto? ... ]] in MODx CMS.

I have the documents displaying in the page, limit is set to 5. The output from my other pagination template placeholders seem to be working but the [+next+] link doesn't load the next set of 5 documents (going in descending date order).

Here's my template code:

[[Ditto?
    &parents=`13`
    &tpl=`ArticleListChunk`
    &display=`5`
    &&removeChunk=`Comments`
    &paginate=`1`
    &extenders=`summary,dateFilter`
    &paginateAlwaysShowLinks=`0`
    &dateFormat=`%F %D %Y`
]]

<p>Showing <strong>[+start+]</strong> - <strong>[+stop+]</strong> of <strong>[+total+]</strong> Articles</p>
<ul class="clearfix">
    <li>[+previous+]</li>
    <li>Page <strong>[+currentPage+]</strong> of [+totalPages+]</li>
    <li>[+next+]</li>
</ul>


The output I get is:

Showing 1 - 5 of 17 Articles

Page 1 of 4
Next >


as you can see the output is correct, however when I click the 'next' link the resulting URL is .../news.html?start=5 but the content of the page stays the same (i.e. the latest 5 documents are shown!).

This is how the template and functionality was when I was inherited this project from a client, and I have never used MODx CMS before -- can anyone help me please?

I there a way to update the SQL offset with a parameter or something? I've been all through the Wiki pages for Ditto / MODx but can't find what I need or what I should be doing that I'm not!

Chris
  • 882
  • 1
  • 10
  • 22

2 Answers2

1

I would think you need to call ditto uncached [[!Ditto? attribs ]]

That's just a guess.

Also it looks like you are using EVO? check the cache syntax, you might need to put an exclamation mark at the end as well. [[!Ditto? attribs !]]

Sean Kimball
  • 4,506
  • 9
  • 42
  • 73
  • Thanks I hadn't considered that, it sounds right given what I've read but for some reason it didn't work. I tried both a leading and a leading with trailing '!' but these only resulted in blank pages both times. Do I have to force a cache refresh? Also how can I check what version of MODx I'm using? – Chris Sep 20 '12 at 17:09
  • I would dump the cache - yes, you are probably using evo if those tags are working at all ... but revo will have the version in the login page, and under system info. I imagine evo will have it in a similar spot. – Sean Kimball Sep 20 '12 at 17:47
0

After plenty of searching I found a post on the MODx forum that pointed me in the right direction.

Turns out that caching was enabled in the page/document's settings (doh!). I disabled this and now it works fine!

However I have not set the no-caching token ('!') in Ditto's parameter string which, including the answer from Sean, my research has suggested is advisable and/or required. I've not worked with MODx before so I can't say for certain, but it seems to work without this for me!

Thanks @SeanKimball as your answer set me down the right path.

Chris
  • 882
  • 1
  • 10
  • 22
  • No Problem Mark, you definitely do want to cache the page though. If you set the no-cache token in a tag, the page will still get cached, but the output from the tag will also still be processed. [neat eh?] – Sean Kimball Sep 21 '12 at 02:03
  • So are you saying I ought to be able to leave the page setting as 'cached' but if I use the '!' no-cache marker in Ditto's command string this output will not be cached and is still processed dynamically? -- That doesn't seem to be what I'm getting though, although that _would_ be great! – Chris Sep 21 '12 at 15:08
  • 1
    yes - absolutely. In fact you can test it. just take a look at the cache file for that resource - if you see the content of the page, but the [[!ditto? *attribs*]] tag then it's being processed. Also - I should have mentioned [but forgot] you can also call the placeholders uncached i.e. [[!+next!]]. your cache file should be in: core/cache/resource/web/resources/_resource_id_.cache.php – Sean Kimball Sep 21 '12 at 15:38