function _jsParse(){ $str = "<script language=\"javascript\"> imgopen = \"$this->imgOpen\"; imgclose = \"$this->imgClose\"; </script><script src=\"$this->js\" language=\"javascript\"></script>"; return $str; } /* * 展开分类$cataId * *param $cataId int 要展开的分类的编号 */ function parseCurrent($cataId){ $str = ''; $str .= $this->_parseCurrentTpl($cataId); while(isset($this->treeCList[$cataId]) && $this->treeCList[$cataId]!=0){ $cataId = $this->treeCList[$cataId]; $str = $this->_parseCurrentTpl($cataId).'->'.$str; } $this->currentStr = &$str; } function _parseCurrentTpl($cataId){ $data = $this->treeData[$cataId]; $str = preg_replace(' ¦__id__ ¦', $data['id'], $this->currentTpl); $str = preg_replace(' ¦__name__ ¦', $data['name'], $str); return $str; } /* * 解析当前分类的路径 * *param $cataId int 要解析的主分类的编号 */ function expand($cataId){ if($this->expand>0) return ; $str = ''; if(isset($this->treePList[$cataId])) $str .= "expand($cataId);"; while(isset($this->treeCList[$cataId]) && $this->treeCList[$cataId]!=0){ $str .= "expand(".$this->treeCList[$cataId].");"; $cataId = $this->treeCList[$cataId]; } $this->treeStr .= "<script language=\"javascript\">$str</script>"; } /* * 返回当前分类的路径 */ function getCurrentStr(){ 希望看到更多更经典的开发技巧,请随时刷新《开发特区》栏目。
|
正在阅读:一棵php的类树(支持无限分类)一棵php的类树(支持无限分类)
2004-04-28 14:35
出处:CSDN
责任编辑:linjixiong
键盘也能翻页,试试“← →”键