We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20549
    • 29 Posts
    Quote from: lokust at Jun 15, 2009, 07:06 PM

    Evening all,

    This issue has been resolved - please find the amended snippet code for parse_chunks snippet below.
    The snippet now allows snippets embedded in chunks to run correctly.

    Full credits and gratitude to Aleksander (Modx user: Alik)

    <?php
    $ar_chunks = split(',',$chunks);
    $ar_chunks = array_unique($ar_chunks);
     
    $output = '';
     
    foreach ($ar_chunks as $chunk) {
      if ($chunk != '') {
        $c = $modx->getChunk($chunk); /*** now string $c contains chunk's content -> raw mix of html and modx tags ***/
        /*** now it is a time to parse snippet tags in string $c ***/
        $c = $modx->evalSnippets($c); /*** yeah! done! ***/
        /*** of course, it might be done with a single step :)
          $output .= $modx->evalSnippets($modx->getChunk($chunk));
          important notice: evalSnippet function recognizes only cached version of snippets [[...]]
         ***/
        if ($c) $output .= $c;
      }
    }
     
    return $output;
    ?>

    THANK YOU!!!
      • 3749
      • 24,544 Posts
      Quote from: Bruno17 at Jul 09, 2009, 12:51 AM

      doesn’t it work this way?:

      make the TV not a checkbox, but Text-TV and write your chunks you want comma-seperated.

      chunkA,chunkB,chunkC,chunkD

      chunkB,chunkA,chunkF,chunkC

      That works, but it kind of defeats the original purpose of Shaun’s TV-based chunks which automatically shows all the chunks in a given category.

      http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 10567
        • 6 Posts
        The original is great for showing all items in a given category. The ’fix’ is great for giving control over which items appear on each page by allowing the user/admin to select only what they want to appear. I implemented ManagerManager with a few minor tweaks and now the user can control which items appear in their sidebar and control the sort-order per page as well.