I have just had the strangest snippet experience and even after a night of sleeping on it thinking it was all me (maybe still is) , I have come back to the same results.
I do not see how the code in the snippet would play any part in this so I will summarize. The overall end result (failure) is the nothing is ever returned by the snippet and/or blank is always returned.. not sure.
Snippet
$output = '';
........... code hear ............
$output = 'Adam';
return $output;
The result is nothing returned. The page itself is resolving and all the page content above and below returns but the area where the snippet is does not get placed.
Now my first thought is of course snippet is not running, tag is bad, cache is stuck. Tried all those. Cleared Cache. Open FS and even emptied all files/folders in ./core/cache.
And if I do this
$output = '';
........... code hear ............
$output = 'Adam';
echo $output;die;
return $output;
I get the echo of $output just one line before it is suppose to be returned.
Also this has no positive effect
$output = '';
........... code hear ............
$output = 'Adam';
return 'ADAM';
So this was my solution and it works... but what is going on
$output = '';
........... code hear ............
$output = 'Adam';
$modx->setPlaceholder('mySnippet',$output);
return '';
Resource
[[!mySnippetTag]]
[[+mySnippet]]
Call me crazy or overworked. Both probably fit.
Update: All tag names are for demo only they are not my actual tag names...