We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7155
    • 160 Posts
    Hi

    I have a snippet I am working on and I have a strange problem. On the greater part of it, I use $modx->parseChunk() and set my placeholders for the chunks. They are displayed without any problems.

    But when I tried setting a placeholder after generating output, it does not show.

    I used the method:
    $modx->setPlaceholder(’myPlaceholder’,$myOutPutFromSnippet);

    when I put the placeholder in the content as [+myPlaceholder+], nothing shows.

    I have tried re-writing the function and clearing the cache. It does not solve anything.

    Strangely enough, if I use "print ’[+myPlaceholder+]’;" (without the quotes), immediately after setting it, the output is displayed...but it defeats the purpose of placeholder, if I have to call them within the code....

    I have seen that other snippet code includes ob_start(),ob_get_contents() and ob_end_clean()....would this be what I need? or is there something I shouldnt do?