/** * 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. * @param integer $id the ID of the model to be loaded * @return WPages the loaded model * @throws CHttpException */ public function loadModel($id) { $model = WPages::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php $data = WPages::PageList(10, 0, $titlepage); $total = WPages::getTotalPages(10, 0, $titlepage); $page = ceil($total / 10); if (!empty($data)) { ?> <ul id="listPageData" style="list-style: none;"> <?php foreach ($data as $item) { ?> <li><a href="<?php echo Yii::app()->CreateUrl("wPages/view", array("id" => $item["id"])); ?> "><img style="margin-right: 10px;" src="<?php echo Yii::app()->theme->baseUrl; ?> /img/dot-2.png"/><?php if (!empty($item["group_name"]) and Yii::app()->session["group_id"] == 3) { ?> <span style="color: #CF2626; font-weight: bold; margin-right: 5px;">[<?php echo ucfirst($item["group_name"]); ?> ]</span><?php } echo $item["title"]; ?> </a> <?php if (Yii::app()->session["group_id"] == 3) { ?>