Yii Framework Forum: Widget Creation Problem - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Widget Creation Problem Rate Topic: -----

#1 User is offline   Win Naung 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 22
  • Joined: 24-August 10

Posted 24 August 2010 - 11:27 AM

Hi,

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.

Quote

YiiBase::include(Comment.php) [<a href='yiibase.include'>yiibase.include</a>]: failed to open stream: No such file or directory
Source File

C:\xampp\htdocs\yii\framework\YiiBase.php(338)

00326: * @param string class name
00327: * @return boolean whether the class has been loaded successfully
00328: */
00329: public static function autoload($className)
00330: {
....


Please help me.

In MainSideMenu,
Yii::import('zii.widgets.CPortlet');

class MainSideMenu extends CPortlet {
    public function init() {
        $this->title = CHtml::label('<span class="sidemenutitle">Category</span>', 'pcategory');
        parent::init();
    }

    protected function renderContent() {
        $this->render('categoryMenu');
    }
}


In categoryMenu.php
<ul>
    <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>
</ul>


In Column2.php,
$this->widget('MainSideMenu');

0

#2 User is offline   Mike 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 3,013
  • Joined: 06-October 08
  • Location:Upper Palatinate

Posted 25 August 2010 - 02:56 AM

This says:

Quote

YiiBase::include(Comment.php) [<a href='yiibase.include'>yiibase.include</a>]: failed to open stream: No such file or directory
Source File


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)?
0

#3 User is offline   Win Naung 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 22
  • Joined: 24-August 10

Posted 25 August 2010 - 08:12 AM

View PostMike, on 25 August 2010 - 02:56 AM, said:

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)?



Hi,
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.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users