开发者

How to use the CakePHP function called generatetreelist?

I am new to CakePHP and this function so please help me as you can.

generatetreelist(null, null,'{n}.Category.name', '  - ');

this shows categories name and childrens perfect but I want 开发者_运维知识库to show my all fields of my categories in my index.ctp. For example name(already showing), status. if you could solve my problem? please do it... in my view I used:

foreach($categories as $key=>$value) {

   echo $value;//it shows just name..

}

in my controller:

$nCategories = $this->Category->generatetreelist(null, '{n}.Category.id','{n}.Category.name', '  - ');
                    $this->set(compact('nCategories',$this->paginate('Category'))); 


you want to use find('threaded'), not generatetree list ()


$params = array(
        'recursive' => -1,
        'fields' => 'Category.id, Category.name, Category.parent_id',

    );
    $categories  = $this->Category->find('threaded',$params);
    debug($categories);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜