I’m building a simple snippet to check wether a TV is empty and inject a piece of HTML-code if not. So far it looks something like this:
// snippet called like: [[optional? &tv=`tv_to_check` &inline=`HTML_to_inject`]]
global $modx;
$tmp = $modx->getTemplateVarOutput($tv);
$tv = $tmp[$tv]; // overrides $tv with new values
$output = ’’;
if (!empty($tv)) {
$modx->setPlaceholder(’tv’, $tv);
$output = $inline;
}
return $output;
With that out of the way, what I was planning to do is something like
<div id="container" [[optional? &tv=`sidebar` &inline=`class="has_sidebar"`]]>. My problem is that it doesn’t work; it seems that the equal sign in the @inline-attribute messes things up. Can I escape it somehow?
Edit: never mind, I did a search and got some results (this time.. I didn’t the first time for some reason). Seems like it’s not possible. I’ll try and work around it using chunks or something..