Excuse me on my soapbox this morning (I won’t stay on here long):
I think that crossover in web projects is simply because people don’t understand the implications that come with mixing logic and presentation. Or don’t yet fully see the benefits of completely isolating them.
Regardless, I’m cringing, just FYI, and begging people to keep such logic out of their content... why not just use Smarty if you want to get all complex like that? I prefer the concept of embedded templates (i.e. chunks) and simply author the necessary PHP logic to decide which chunk (or other MODx add-on) to present. Is it really any harder to write:
<?php
if (in_array($modx->documentIdentifier, array(2,3))) {
return $modx->getChunk('Chunk');
}
elseif ($modx->documentObject['mytv']['value'] == 'somevalue') {
return $modx->getChunk('OtherChunk');
}
?>
And the performance benefits of this over the phX approach? Well, let’s just say you are likely adding more than 2 complete additional parser passes by using such phX logic vs. encapsulating it in a snippet. You are also losing complete control over the order in which any additional tags are parsed.
Just some thoughts that came to mind this morning; take it with a grain of salt... nothing more than my opinions here.