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

    I’m new to this forum and have a problem.

    I would like to have (as an input-option in a template variable) a list (pageTitle == id) of the child elements of the currently active resource. I started to write a small snippet and it works half-way in the front-end (Pagetitle isn’t displayed correctly). In the backend I get nothing as a result.

    Snippet:
    <?php
    $parent = $modx->resource->get('id');
    $childArr = $modx->getChildIds($parent,1);
    
    foreach ($childArr as $child)
    {
    $opArr[]=$child['pagetitle']."==".$child['id'];
    }
    
    foreach($opArr as $childs)
    {
    echo $childs;
    }


    I don’t get it. What’s the problem for Modx and why doesn’t it work? Thanks for your help! smiley

    Infos: Modx 2.0.8 pl, PHP 5.3.2