We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23019
    • 27 Posts
    Well, what I want to do is having a template variable for some documents which are like "articles" with some authors.

    In this TV the options can be 1 or more (the authors) but, and here is the difficulty, each author have to be one of my site’s id (concretly one from inside one folder of my site).

    I know that @EVAL cans evaluate php expressions but I don’t know how to get a expression which can get me a string wich the format "pagetitle1||pagetitle2||pagetitle3... " for using it like options for the Multi-Select variable.

    Can somebody help me? Thanks.
      • 34017
      • 898 Posts
      I usually create a snippet and use @eval $modx->runSnippet....
        Chuck the Trukk
        ProWebscape.com :: Nashville-WebDesign.com
        - - - - - - - -
        What are TV's? Here's some info below.
        http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
        http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
        • 23019
        • 27 Posts
        Yes, but I didn’t know very much about PHP, but the words of the user xyzvisual was very helpful smiley :

        $children = $modx->getDocumentChildren(PARENT_ID,1,0,'id,pagetitle', 'hidemenu=0','menuindex ASC,pagetitle', 'DESC');
        $childrenCount=count($children);
        //bucle que recorre el array de id
        for($x=0; $x<$childrenCount; $x++) {
        $output .=$children[$x]['pagetitle'].'||';
        }
        // To delete the last 2 separators
        return  substr( $output, 0, -2);