-
☆ A M B ☆
- 1,031 Posts
Do you want to change the record template in each row? Or do you want to change the template for the whole Ditto call?
Your call above could be used if you want to change the template for a whole Ditto call with a template chunk name in a TV (maybe you have to call this TV by [*mytemplate*] – this depends where you are using it – [* *] in a template/document content and [+ +] i.e. in a Ditto template).
If you want to switch the record template in each row, you could use the PHx (by PHx plugin or by using the built in PHx parser of Ditto). Example: [+template:eq=`1`:then=`xxx`:else=`yyy`+] would switch the output to xxx if the resource template is 1 and to yyy elsewhere.
-
☆ A M B ☆
- 38 Posts
Hi, Jako
I need to change the model for each row where &tpl= needs to be dynamic
Thanks
-
☆ A M B ☆
- 38 Posts
Could you give me a more practical example of how to use the PHX, I will use only two types of templates
Eg: template1 and template2
-
☆ A M B ☆
- 1,031 Posts
Which TV/DocVar should be used to switch the template?
-
☆ A M B ☆
- 38 Posts
Thanks, Jako
I will test and give feedback
eq=`aaa` should be is=`aaa` :)
Ditto have PHx built in
http://rtfm.modx.com/extras/evo/phx
http://wiki.modxcms.com/index.php/PHx
with MODX1012 we have an If snippet
[[if? &is=`[*parent*]:is:5` &then=`@TPL:chunk-name`]]
Or create the perfect code:
https://forums.modx.com/thread/2299/alternative-to-phx-for-conditional-statements#dis-post-14903