We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4510
    • 0 Posts
    I recently got stuck with an issue possibly regarding the parsing order.

    I have the following setup:

    • A template uses the snippet getResource
    • ...where the resource-input-field comes from a placeholder
    • ...set by my own snippet (which is itself defined in a template variable).

    My (uncached) snippet, inside the uncached template variable (below), sets the placeholder using:
    <?php
    $myResource = $modx->getObject('modResource', 1);
    $modx->setPlaceholder('vpuffar', $myResource->getTVValue('vpuffar'));
    ?>
    


    The getResource-call is inside my template (uncached placeholder according to http://rtfm.modx.com/display/revolution20/Tag+Syntax#TagSyntax-ParsingOrder):

    Template:
    [[!*resewidget?]]   <-- The snippet call may change from resource to resource
    <body>
    [[!getResources?
        &parents=`-1` 
        &resources=´[[!+vpuffar]]´ <-- This value isn't read by getResources
        &tpl=`vpuff` 
        &showHidden=`1` 
        &includeTVs=`1` 
        &sortby=`id` 
        &sortdir=`ASC`
    ]]
    ...
    [[!+vpuffar]] <-- The value can be read here (I want this value if it's set)
    [[!*vpuffar]] <-- This is another possible value (...otherwise i want this value as default)
    </body>
    


    myResource is just a resource that has been decided depending on a custom resource implementation (like a categories in a webshop).
    If I could set *vpuffar it might be a possible way, however, I don’t believe that is the correct way of solving it; or even allowed due to parsing order.

    Versions: MODx-version - 2.0.8 (to be upgraded today), getResource v. 1.3.0