<?php /* # Name: DropDownTree # Version: 1.0.0 # Author: Urique Dertlian ([email protected]) # Date: Oct 4, 2007 # Using: Create TV of kind "DropDown List Menu", feel elements field with string: @EVAL return $modx->runSnippet("DropDownTree",array('doc'=>0)); Here "0" is ID of parent document children of which will be displayed in DropDown menu. */ if(!function_exists("getItems")) { $s="Choose...==''"; function getItems($p=0, $l=0) { global $modx,$modx_charset; ($modx_charset=='UTF-8') ? $nbsp=chr(0xC2).chr(0xA0) : $nbsp=chr(0xA0); $c=$modx->getDocumentChildren($p); foreach($c as $k) { $out.='||'.str_repeat($nbsp,$l*5).$k['pagetitle']."==".$k['id']; $out.=getItems($k['id'],$l+1); } return $out; } } return $s.getItems($doc); ?>