Widget Creation Problem


  1. I created the class (MainSideMenu.php) extended from CPortlet. The class file is in the /protected/component folder.

  2. After that I created the view file (categoryMenu.php) under the /protected/component/views folder.

  3. I used this portlet in the widget which is in the column2.php.

After I put the widget in the column2.php, I got the following error.

Please help me.

In MainSideMenu,


class MainSideMenu extends CPortlet {

    public function init() {

        $this->title = CHtml::label('<span class="sidemenutitle">Category</span>', 'pcategory');



    protected function renderContent() {




In categoryMenu.php


    <li><?php echo CHtml::link('Tee',array('post/create')); ?></li>

    <li><?php echo CHtml::link('Blouse',array('post/admin')); ?></li>

    <li><?php echo CHtml::link('Short Pant',array('comment/index'))

        . ' (' . Comment::model()->pendingCommentCount . ')'; ?></li>

    <li><?php echo CHtml::link('Others',array('site/logout')); ?></li>


In Column2.php,


This says:

it can not find the class “Comment.php”. It’s used in categoryMenu.php. Do you have this model class? Is it in one of your imported directories? Is the file name correct (upper/lower case)?


Thanks for your quick reply. After I checked the Comment.php, I found that I wrongly declare the Comment.php.

Then I removed the php file from my code. Now it is OK.

Thanks so much.