CakePHP显示ul中的父类别和子类别

CakePHP显示ul中的父类别和子类别,cakephp,categories,Cakephp,Categories,我有一个索引页类别 我想显示所有父类别及其子类别,如下所示, 怎么做? 选择c1.cat\u id作为childID,c1.cat\u name作为ChildName,c2.cat\u name作为ParentName 来自类别c1 左外连接类别c2 在c1.parent=c2.cat_id上,您尝试的代码是…?^^thnks,用于在CategoriesControllerpublic function index()中进行注释({$this->Category->recursive=0;//$

我有一个索引页类别 我想显示所有父类别及其子类别,如下所示, 怎么做?

选择c1.cat\u id作为childID,c1.cat\u name作为ChildName,c2.cat\u name作为ParentName 来自类别c1 左外连接类别c2
在c1.parent=c2.cat_id

上,您尝试的代码是…?^^thnks,用于在CategoriesController
public function index()中进行注释({$this->Category->recursive=0;//$this->set('categories',$this->paginate());$CategoryList=$this->categories->generateTreeList(null,null,null,'-');$this->set(compact('CategoryList');}
在视图
中,通过调试,我可以显示所有类别及其子类别,但我可以像显示捕获一样显示它