I’m trying to pass the results of a snippet to Ditto as the value of startID. The snippet, here called ’rand_number’, generates a random number between 11 and 13.
When I call Ditto this way:
[!Ditto?&display=`all`&tpl=`slideshow`&startID=`[[rand_number]]` &sortBy=`menuindex` &sortDir=`ASC`!]
it works fine, but the "random" number is always the same. I assume it’s cached. It works as expected when I run it uncachced outside of Ditto.
This:
[!Ditto?&display=`all`&tpl=`slideshow`&startID=`[!rand_number!]` &sortBy=`menuindex` &sortDir=`ASC`!]
and this:
[[Ditto?&display=`all`&tpl=`slideshow`&startID=`[[rand_number]]` &sortBy=`menuindex` &sortDir=`ASC`]]
both cause Ditto to choke.
Does anyone know what I’m doing wrong (or if there’s a better way to do this)?
Thanks in advance.
Embedded snippet calls need to alternate the cache setting [[ [! !] ]]
The issue is resolved by making the page on which the snippet is called uncacheable, but it doesn’t seem like the right solution.
Quote from: dca.web at Apr 17, 2009, 01:31 PM
The issue is resolved by making the page on which the snippet is called uncacheable, but it doesn’t seem like the right solution.
Try leaving the page cached, then using [!Ditto . . . [[random]] !]. I believe that will, paradoxically, leave the [[random]] call uncached. BTW, this problem goes away in MODx Revolution.