cvs: pear /Tree Common.php

From: Date: Tue, 02 Apr 2002 23:11:55 +0000
Subject: cvs: pear /Tree Common.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-2997@lists.php.net to get a copy of this message
cain Tue Apr 2 18:11:55 2002 EDT Modified files: /pear/Tree Common.php Log: - added method getPathAsString Index: pear/Tree/Common.php diff -u pear/Tree/Common.php:1.2 pear/Tree/Common.php:1.3 --- pear/Tree/Common.php:1.2 Wed Feb 6 18:27:49 2002 +++ pear/Tree/Common.php Tue Apr 2 18:11:55 2002 @@ -16,7 +16,7 @@ // | Authors: Wolfram Kriesing <wolfram@kriesing.de> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.2 2002/02/06 23:27:49 cain Exp $ +// $Id: Common.php,v 1.3 2002/04/02 23:11:55 cain Exp $ require_once('Tree/Options.php'); @@ -174,6 +174,25 @@ $firstRoot = $this->getFirstRoot(); return $firstRoot['id']; } + + /** + * returns the path as a string + * + * @access public + * @version 2002/03/28 + * @access public + * @author Wolfram Kriesing <wolfram@kriesing.de> + * @param mixed $id the id of the node to get the path for + * @return array this array contains all elements from the root to the element given by the id + * + */ + function getPathAsString( $id , $seperator='/' ) + { + $path = $this->getPath($id); + foreach( $path as $aNode ) + $ret.= $aNode['name'].$seperator; + return $ret; + } // end of function

« previous php.pear.cvs (#2997) next »