Exemplo n.º 1
0
 /**
  * 专题首页
  */
 public function actionIndex()
 {
     $specialModel = new Special();
     $specialCriteria = new CDbCriteria();
     $specialCriteria->addCondition('t.status_is=:status');
     $specialCriteria->params[':status'] = 'Y';
     $specialCriteria->order = 't.id DESC';
     $bagecmsSpecialCount = $specialModel->count($specialCriteria);
     $specialPages = new CPagination($bagecmsSpecialCount);
     $specialPages->pageSize = 15;
     $specialPageParams = XUtils::buildCondition($_GET, array());
     $specialPageParams['#'] = 'list';
     $specialPages->params = is_array($specialPageParams) ? $specialPageParams : array();
     $specialCriteria->limit = $specialPages->pageSize;
     $specialCriteria->offset = $specialPages->currentPage * $specialPages->pageSize;
     $specialList = $specialModel->findAll($specialCriteria);
     $this->_seoTitle = '专题 - ' . $this->_conf['site_name'];
     $this->render('index', array('bagecmsDataList' => $specialList, 'bagecmsPagebar' => $specialPages));
 }
Exemplo n.º 2
0
 public function run()
 {
     $model = new Special();
     //查询条件
     $criteria = new CDbCriteria();
     $condition = '1';
     $title = Yii::app()->request->getParam('title');
     $title && ($condition .= ' AND title LIKE \'%' . $title . '%\'');
     $criteria->condition = $condition;
     $criteria->order = 't.id DESC';
     $count = $model->count($criteria);
     //分页
     $pages = new CPagination($count);
     $pages->pageSize = 10;
     $pages->applyLimit($criteria);
     //结果
     $result = $model->findAll($criteria);
     $this->controller->render('index', array('model' => $model, 'datalist' => $result, 'pagebar' => $pages));
 }
Exemplo n.º 3
0
 /**
  * 首页
  *
  */
 public function actionIndex()
 {
     $model = new Special();
     $criteria = new CDbCriteria();
     $condition = '1';
     $title = $this->_request->getParam('title');
     $titleAlias = $this->_request->getParam('titleAlias');
     $title && ($condition .= ' AND title LIKE \'%' . $title . '%\'');
     $titleAlias && ($condition .= ' AND title_alias LIKE \'%' . $titleAlias . '%\'');
     $criteria->condition = $condition;
     $criteria->order = 't.id DESC';
     $count = $model->count($criteria);
     $pages = new CPagination($count);
     $pages->pageSize = 13;
     $pageParams = $this->buildCondition($_GET, array('page_name_alias', 'page_name'));
     $pages->params = is_array($pageParams) ? $pageParams : array();
     $criteria->limit = $pages->pageSize;
     $criteria->offset = $pages->currentPage * $pages->pageSize;
     $result = $model->findAll($criteria);
     $this->render('index', array('datalist' => $result, 'pagebar' => $pages));
 }