Hello,
I have a snippet which should do something only if a certain chunk has any content.
Simply put:
<?php
$xx = "{{mychunk}}";
if ($xx == "") {
print "Chunk is empty, no action";
}
else {
print "Chunk has content, do your thing...";
}
?>
This does not work. Even using other PHP tests like strlen or empty functions.
They all jump to the ’else’-branch regardless if the chunk has any content.
My guess is this has something to do with the order of executing
MODX tags and PHP code.
But, the question is therefore: How do I test the content of a chunk in a snippet?
Thanks for your answers.
Bert