[[*template:is=`2`:then=`
[[*isfolder:is=`0`:then=`
[[*description:notempty=`<p>[[*description]]</p>`]]
`]]
`]]
[[*template:is=`2`:then=`Works great`]
[[!MyDescription]]
<?php
/* MyDescription snippet */
$output = '';
$r =& $modx->resource;
if ($r->get('template) == '2') {
if ($r->get('isfolder') == '0') {
$d = $r->get('description');
if (! empty($d) {
$output = '<p>' . $d . '</p>';
}
}
}
return $output;
Thank you for reply, BobRay.
It might work if you put it all on one line, but conditional modifiers, especially complex ones, are very slow and inefficient. I would use a snippet.
It might work if you put it all on one line, but conditional modifiers, especially complex ones, are very slow and inefficient. I would use a snippet. Something like this:
Exactly, once cached it’s fast as typical static (MODX) content.
isn’t the slowness only relevant if the page is fully dynamic? e.g. if its cached it shouldn’t matter since its rendered once no?
And thats a realy nice idea. Sounds like a perfect solutions to me.
we should be able to selectively clear the cache of individual resources (and their dependent elements).