None of the older workarounds work for placeholders any more. The PHx plugin simply eats any non-phx placeholders. They still exist in the $modx->placeholders array, but they are never displayed. The only way to use them is to use a snippet to get the placeholder value and return it. They work within chunk tpls for Wayfinder, Ditto, etc because they are processed by the snippet. Put a placeholder in the template, a chunk, or the document content and they won’t show up.
Snippets that have their own PHx class .php file (such as Ditto and Jot) work just fine as long as the PHx plugin is not enabled.
-
- 2,877 Posts
-
- 354 Posts
Hm, I experienced this bug today as well. It occured when running PHx 2.1.3 on PHP 5.2.5
This is a known issue with using the PHx plugin. The plugin provides its own "unused placeholder" garbage collection. There are two solutions.
1. Have snippets cached in uncached pages.
2. Use a snippet to return the desired placeholder.
return $modx->getPlaceholder('placeholder-name');
The placeholder values are still in the MODx placeholders array, it’s just that the plugin has removed the placeholder tags from the document before they are processed by the MOdx parser.
-
- 354 Posts
Thanks for your reply. I deactivated PHx for the time being. I moved the simple logic i wanted to do with PHx into a snippet.
Glad you got it sorted.
For many things while it takes a minute or two more to create your conditional snippets (provided you know how) it may yield better results by using snippets anyway. If you can do a snippet you should.
Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup
magician.
Blog ✦
Twitter ✦
LinkedIn ✦
GitHub