public function getRecentComments() { return Blogcomment::model()->findRecentComments($this->maxComments); }
<ul> <li><?php echo CHtml::link('Create New Post', array('blogpost/create')); ?> </li> <li><?php echo CHtml::link('Manage Posts', array('blogpost/admin')); ?> </li> <li><?php echo CHtml::link('Manage Comments', array('blogcomment/index')) . ' (' . Blogcomment::model()->pendingCommentCount . ')'; ?> </li> </ul>
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. */ public function loadModel() { //var_dump("loadModel"); if ($this->_model === null) { if (isset($_GET['id'])) { $this->_model = Blogcomment::model()->findbyPk($_GET['id']); } if ($this->_model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } } return $this->_model; }