Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Reading category tree, using in CMenu, CSiteMap

Kris Thom White edited this page Oct 31, 2013 · 3 revisions

You can use the standard Yii function CMenu http://www.yiiframework.com/doc/api/1.1/CMenu and use a WS provided function Category::GetTree() which provides an array ready to be used by CMenu. This function also can be used with CTreeView.

$this->widget('zii.widgets.CMenu',array( 'items'=>Category::GetTree() ));

CMenu can be used for many functions including left-side menus since it provides the top level output in a list and default CSS classes that can be customized.

CMenu can also be modified, such as providing other dropdown functionality per http://www.yiiframework.com/wiki/211/creating-a-css3-drop-down-menu-using-cmenu/

###New combined menu

As of Web Store 3.1, there is a new feature which is recommended for use to read the menu, which can be accessed as $this->MenuTree

as in the following example

$this->widget( 'zii.widgets.CMenu', array( 'items' => $this->MenuTree, 'id'=>'menutree' ));

Clone this wiki locally