Can someone explain to me why tpl=`@CODE foo` is not always working as expected?
Example:
This works fine:
[!Ditto? &parents=`0` &tpl=`@CODE <strong>[+pagetitle+]</strong> (doc id [+id+])<br />` &total=`50` &display=`50`!]
This doesn’t:
[!Ditto? &parents=`0` &tpl=`@CODE <a href="[~[+id+]~]" title="[+longtitle+]"><strong>[+pagetitle+]</strong></a> (doc id [+id+])<br />` &total=`50` &display=`50`!]
The error I get is: &tpl either does not contain any placeholders or is an invalid chunk name, code block, or filename. Please check it.
However, if I put the same HTML-block
<a href="[~[+id+]~]" title="[+longtitle+]"><strong>[+pagetitle+]</strong></a> (doc id [+id+])
into a chunk and call it like this:
[!Ditto? &parents=`0` &tpl=`dittoChunk` &total=`50` &display=`50`!]
it works again.
What causes one kind of @CODE usage to be parsed by Ditto, but not another? Is it the use of double quotes? The tilde ~ character?
I’ve been testing this on the latest stable modx release, with Ditto 2.0.2 + 2.1. In the german forum someone noticed the @CODE not working at all.
I’ve tried using tpl=`@CODE: foo` as well (adding : after @CODE), that doesn’t make any difference.
MODx 0.9.6.1p2 (rev 3281)
Ditto 2.0.2 + Ditto 2.1
I searched the forum, but couldn’t find any related posts. I’d be happy if someone could shed some light on this. Using @CODE is a very cool feature imho. Sometimes you just want to enter small bits of HTML directly into the Ditto call and don’t want to create an extra chunk, but if it’s behaving erratically, I’d rather not depend on it...