We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8779
    • 93 Posts
    Is it possible to put HTML Code inside a snippet?
    How to do it?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      $output .= '<li'> . $value . '</li>';
      ...
      return $output;

      is one way. You can also echo each line, but that sometimes has unexpected results; it can show up in odd places on the page.

      You can use heredoc syntax.

      (wow, looking that reference up, I just discovered the unparsed "nowdoc"! )

      You can also load the $output into the placeholders array with $modx->setPlaceholder(’placeholder-name’, $output) and then put the placeholder anywhere you want (as long as it is in the HTML after the snippet call).

      This is MODx; there’s lots of ways to do just about anything!
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 8779
        • 93 Posts
        I’ve tried that placeholder method before, but the placeholder didn’t show up.

        I’ll try the first one.

        thanks Susan.