framework/zii/widgets/CMenu.php
protected function renderMenuRecursive($items)
	{
		$count=0;
		$n=count($items);
		foreach($items as $item)
		{
			$count++;
			$options=isset($item['itemOptions']) ? $item['itemOptions'] : array();
			$class=array();
			if($item['active'] && $this->activeCssClass!='')
				$class[]=$this->activeCssClass;
			if($count===1 && $this->firstItemCssClass!==null)
				$class[]=$this->firstItemCssClass;
			if($count===$n && $this->lastItemCssClass!==null)
				$class[]=$this->lastItemCssClass;
			if($this->itemCssClass!==null)
				$class[]=$this->itemCssClass;
			if($class!==array())
			{
				if(empty($options['class']))
					$options['class']=implode(' ',$class);
				else
					$options['class'].=' '.implode(' ',$class);
			}

			echo CHtml::openTag('li', $options);

			$menu=$this->renderMenuItem($item);
			if(isset($this->itemTemplate) || isset($item['template']))
			{
				$template=isset($item['template']) ? $item['template'] : $this->itemTemplate;
				echo strtr($template,array('{menu}'=>$menu));
			}
			else
				echo $menu;

			if(isset($item['items']) && count($item['items']))
			{
				echo "\n".CHtml::openTag('ul',isset($item['submenuOptions']) ? $item['submenuOptions'] : $this->submenuHtmlOptions)."\n";
				$this->renderMenuRecursive($item['items']);
				echo CHtml::closeTag('ul')."\n";
			}

			echo CHtml::closeTag('li')."\n";
		}
	}
protected function renderMenuRecursive($items)
	{
		$count=0;
		$n=count($items);
		foreach($items as $item)
		{
			$count++;
			$options=isset($item['itemOptions']) ? $item['itemOptions'] : array();
			$class=array();
			if($item['active'] && $this->activeCssClass!='')
				$class[]=$this->activeCssClass;
			if($count===1 && $this->firstItemCssClass!==null)
				$class[]=$this->firstItemCssClass;
			if($count===$n && $this->lastItemCssClass!==null)
				$class[]=$this->lastItemCssClass;
			if($this->itemCssClass!==null)
				$class[]=$this->itemCssClass;
			if($class!==array())
			{
				if(empty($options['class']))
					$options['class']=implode(' ',$class);
				else
					$options['class'].=' '.implode(' ',$class);
			}

			echo CHtml::openTag('li', $options);

			$menu=$this->renderMenuItem($item);
			if(isset($this->itemTemplate) || isset($item['template']))
			{
				$template=isset($item['template']) ? $item['template'] : $this->itemTemplate;
				echo strtr($template,array('{menu}'=>$menu));
			}
			else
				echo $menu;

			if(isset($item['items']) && count($item['items']))
			{
				echo "\n".CHtml::openTag('ul',isset($item['submenuOptions']) ? $item['submenuOptions'] : $this->submenuHtmlOptions)."\n";
				$this->renderMenuRecursive($item['items']);
				echo CHtml::closeTag('ul')."\n";
			}

			echo CHtml::closeTag('li')."\n";
		}
	}
protected function renderMenuRecursive ( $ items ) { $ count = 0 ; $ n = count ( $ items ) ; foreach ( $ items as $ item ) { $ count ++ ; $ options = isset ( $ item [ 'itemOptions' ] ) ? $ item [ 'itemOptions' ] : array ( ) ; $ class = array ( ) ; if ( $ item [ 'active' ] && $ this -> activeCssClass != '' ) $ class [ ] = $ this -> activeCssClass ; if ( $ count === 1 && $ this -> firstItemCssClass !== null ) $ class [ ] = $ this -> firstItemCssClass ; if ( $ count === $ n && $ this -> lastItemCssClass !== null ) $ class [ ] = $ this -> lastItemCssClass ; if ( $ this -> itemCssClass !== null ) $ class [ ] = $ this -> itemCssClass ; if ( $ class !== array ( ) ) { if ( empty ( $ options [ 'class' ] ) ) $ options [ 'class' ] = implode ( ' ' , $ class ) ; else $ options [ 'class' ] .= ' ' . implode ( ' ' , $ class ) ; } echo CHtml :: openTag ( 'li' , $ options ) ; $ menu = $ this -> renderMenuItem ( $ item ) ; if ( isset ( $ this -> itemTemplate ) || isset ( $ item [ 'template' ] ) ) { $ template = isset ( $ item [ 'template' ] ) ? $ item [ 'template' ] : $ this -> itemTemplate ; echo strtr ( $ template , array ( '{menu}' => $ menu ) ) ; } else echo $ menu ; if ( isset ( $ item [ 'items' ] ) && count ( $ item [ 'items' ] ) ) { echo "\n" . CHtml :: openTag ( 'ul' , isset ( $ item [ 'submenuOptions' ] ) ? $ item [ 'submenuOptions' ] : $ this -> submenuHtmlOptions ) . "\n" ; $ this -> renderMenuRecursive ( $ item [ 'items' ] ) ; echo CHtml :: closeTag ( 'ul' ) . "\n" ; } echo CHtml :: closeTag ( 'li' ) . "\n" ; } }
Recursively renders the menu items.
@param array $items the menu items to be rendered recursively
Recursively renders the menu items .