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

    I looked up how to output a chunk from inside a snippet, but I am not getting anything returned from the following code in the snippet...

    ’mySampleChunk’ definitely exists smiley

    $modx->getChunk(’mySampleChunk’); $modx->putChunk(’mySampleChunk’);

    Im using 0.9.6 rev 2767.

    Thanks
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Well, to begin with, you need to have the chunk put into a variable and do something with it:
      $mychunk = $modx->getChunk('myChunk');
      return $mychunk;

      or maybe
      return $modx->getChunk('myChunk')

      putChunk is just a deprecated function that calls getChunk.
        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
        • 18839
        • 39 Posts
        Thanks Susan,

        Worked perfectly tongue
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Doggone it, I almost broke my laptop screen trying to nail that bug!
            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
            • 27376
            • 576 Posts
            Quote from: sottwell at Nov 19, 2007, 11:22 PM

            Doggone it, I almost broke my laptop screen trying to nail that bug!
            There’s two on my screen that move in exactly the same manner!