Take advantage of Ditto's @FILE property
on 22-Sep-2009 | Comments ( 2 ) Tags: Evolution
Most of the times I use Ditto with custom templates and almost all the time my templates have one or more calls to other snippets. If your custom template sits inside a chunk then you probably know that you need to call Ditto uncached.
The following works only uncached:
<div> <h2><a href="[~[+id+]~]">[+pagetitle:htmlspecialchars+]</a></h2> <div>on [+date+] | Comments ( [[Jot? &docid=`[+id+]` &action=`count-comments`]] ) For: [[GetModxVersion? &ids=`[+modxVersion+]`]]</div> <div>[+introtext:htmlspecialchars+]</div> </div>
with the following Ditto call:
[!Ditto? &parents=`10` &depth=`1` &tpl=`article` &showInMenuOnly=`1` !]
To overcome this caching limitation without creating another snippet you can use the @FILE property. First you would need to put the above template in a file on the server. For this example I've chosen the following path: 'assets/templates/site/chunks/article.html'
And here's the cached Ditto call:
[[Ditto? &parents=`10` &depth=`1` &tpl=`@FILE:assets/templates/site/chunks/article.html` &showInMenuOnly=`1`]]
If you know other Ditto tricks leave a message.
Write a comment
Posts: 1
Reply #2 on : Thu September 24, 2009, 09:41:39
Posts: 1
Reply #1 on : Fri September 25, 2009, 10:28:29