YAMS + Ditto + PHx

This is a user-contributed Extra. If you find issues or would like more info or help, please contact the author.

How can I use PHx and YAMS placeholders within Ditto templates?

First make sure that you have the PHx plugin installed and that its events are set to activate AFTER YAMS. Then, following thomasd's instructions, we do the following:

Turn off Ditto PHx-Substitution via &phx=`0`. Now, no PHx is done so you have to modify your PHx-tags.

For Example:

[+content:striptags+]

should be changed to:

[*phx:input=`((yams_data:[+id+]:content_(yams_id)))`:striptags*]

Now the parsing order is correct:

  1. Ditto replaces the [+id+]-placeholder with the current id
  2. YAMS replaces the ((..))-construct with the actual content
  3. PHx executes the striptags-function and outputs the modified content

For non-multilingual fields like an image-field use:

[*phx:input=`[+image+]`:phpthumb=`73x110`*]

That forces PHx to parse the Ditto-Placeholder.

The final Ditto call may look like this:

[[Ditto?
&parents=`[*id*]`
&tpl=`@FILE:assets/templates/list-item.html`
&noResults=`No Results Available`
&phx=`0`
]]

Suggest an edit to this page.