We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30497
    • 245 Posts
    Quote from: BobRay at Feb 24, 2009, 01:15 PM

    Quote from: Everett at Feb 24, 2009, 10:44 AM

    Looks like you need to return the output from your Snippet. I think Bob may have left that part out...

    I didn’t, but he did. wink

    You have to scroll down to see all the code in my snippet example above, you left out this crucial line at the end of the snippet:

    return($modx->getChunk('MyTplChunk');


    That was a miss! Thanks for pointing that out Bob.

    It still doesn’t work for me with your last line of code. But, it does work when I try Everett’s test of
    return 'Testing...';


    Here is my snippet again:
    <?php
    $id = $pageId;  // sent in snippet call
    
    $fields = 'longtitle,content'; // fields we want
    $active = 1; // we want published docs
    
    $info = $modx->getPageInfo($id, $active, $fields); 
    
    $longTitle = $info['longtitle']; 
    $docContent = $info['content'];
    
    $modx->setPlaceholder('tipTitle',$longTitle);
    $modx->setPlaceholder('tipContent',$docContent);
    
    return($modx->getChunk('getFieldsTemplate');
    //return 'Testing...';
    ?>
    


    Here is my Chunk:
    <h2>[+tipTitle+]</h2>
    <p>[+tipContent+]</p>
    


    and here is my call:
    [!getFields?&tpl=`getFieldsTemplate`&pageId=`108`!]
    
      • 3749
      • 24,544 Posts
      Check the spelling on all your snippet parameters and chunk names (they’re case-sensitive). Make sure the page you’re pulling pageInfo from is published and available as per the current document group permissions.

      Is anything from your getFieldsTemplate showing up?  (Put <p>In Template . . .</p> in there to make sure).

      Then try

      print_r($info);


      in the snippet to make sure that getPageInfo() is returning what you want.
        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