We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22503
    • 12 Posts
    How does the new API function getDocumentChildrenTVars work?

    Am trying to return the regular and TV fields for the children of a folder
    This and every other variation I have tried don't seem to return anything
    $thisid = $etomite->documentIdentifier;
    
    $children = $etomite->getDocumentChildrenTVars($thisid,"thumb");  $childrenCount = count($children);
    $child .= "<ol>";
    for($x=0; $x<$childrenCount; $x++) {
    $child .= "<li>".$children[$x]['id']." - ".$children[$x]['pagetitle']." - ".$children[$x]['description']." - ".$children[$x]['thumb']."<li>";
    }
    $child .= "</ol>";
    return $child;

    thumb is a TV

    I don't speak php very well so I am probably on the wrong track any guidance would be great :?
      • 32963
      • 1,732 Posts
      Hi

      Here's how it should be used:

      getDocumentChildrenTVars
      Returns a two-dimensional array containing the selected TVs of all the children of the document specified.

      Usage:
      getDocumentChildrenTVars($parentid=0, $tvidnames=array(), $published=1, $docsort="menuindex", $docsortdir="ASC", $tvfields="*", $tvsort="rank", $tvsortdir="ASC")

      Example:
      // get all the children of document id 10
      $result = $etomite-> getDocumentChildrenTVars (10,array(“id”,”pagetitle”));
      for ($i=0;$i<count($result);$i++) {
      	echo $result[$i][0][“name”]. “ = ” . $result[$i][0][“value”];
      }
      
        xWisdom
        www.xwisdomhtml.com
        The fear of the Lord is the beginning of wisdom:
        MODx Co-Founder - Create and do more with less.
        • 22503
        • 12 Posts
        Thanks Raymond I get it now smiley