Creating A Side-Bar Category List

I have a two-column layout and would-like to place category list (blog alike system) in the right sidebar. Yii blog demo suggests that I do it using portlets, but it generates lots of HTML I don’t actually need. All I want is <ul>* based list of categories.

What is the best Yii-practice to do that?

Dear Friend

I do not know whetther following is a good practice.

Kindly check this.


<?php $this->beginContent('//layouts/main'); ?>

<div class="span-19">

	<div id="content">

		<?php echo $content; ?>

	</div><!-- content -->


<div class="span-5 last">

	<div id="sidebar">


		$this->beginWidget('zii.widgets.CPortlet', array(



		$this->widget('zii.widgets.CMenu', array(





		$this->renderPartial("//layouts/list");//this is the added line.


	</div><!-- sidebar -->


<?php $this->endContent(); ?>

Now I have









Thanks for quick answer, but I need my category list to be loaded from database, not static list.

Dear Friend

Then that is the case, then I go for portlets.

Anyway we can do this.


Then in list.php


<?php foreach ($fruits as $fruit) { ?>

<li><?php echo $fruit->name; ?></li>

<?php } ?>


simple enough you don’t have to use what yii gives you out of the box just loop thru the array



<?php foreach(Fruit::model()->findAll() as $f): ?>

    <li><?php $f->name></li>

<?php endforeach; ?>


seenivasan, alirz23

Thanks for the answers. It’ll work fine for me.