本文整理汇总了PHP中Ad::findAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Ad::findAll方法的具体用法?PHP Ad::findAll怎么用?PHP Ad::findAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ad
的用法示例。
在下文中一共展示了Ad::findAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getads
public static function getads($pid)
{
$model = new Ad();
$criteria = new CDbCriteria();
$criteria->addCondition("is_show=1 and pid={$pid}");
$criteria->order = 'orderid ASC';
$ads = $model->findAll($criteria);
return $ads;
}
示例2: run
public function run()
{
$model = new Ad();
//条件
$criteria = new CDbCriteria();
$title = trim(Yii::app()->request->getParam('title'));
$position_id = intval(Yii::app()->request->getParam('position_id'));
$title && $criteria->addColumnCondition(array('title' => $title));
$position_id && $criteria->addColumnCondition(array('position_id', $position_id));
$criteria->order = 't.id ASC';
$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));
}
示例3: actionIndex
/**
* 广告管理
*
*/
public function actionIndex()
{
$model = new Ad();
$criteria = new CDbCriteria();
$condition = '1';
$title = $this->_request->getParam('title');
$position_id = $this->_request->getParam('positionID');
$position_id && ($condition .= ' AND position_id =' . $position_id);
$title && ($condition .= ' AND title LIKE \'%' . $title . '%\'');
$criteria->condition = $condition;
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 13;
$pageParams = $this->buildCondition($_GET, array('title'));
$pages->params = is_array($pageParams) ? $pageParams : array();
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->render('ad_index', array('datalist' => $result, 'pagebar' => $pages));
}
示例4: actionAd
/**
* 广告管理
*
*/
public function actionAd()
{
parent::_acl('ad_index');
$model = new Ad();
$criteria = new CDbCriteria();
$condition = '1';
$title = $this->_gets->getParam('title');
$title && ($condition .= ' AND title LIKE \'%' . $title . '%\'');
$criteria->condition = $condition;
//$criteria->params = '';
$criteria->order = 't.id DESC';
$count = $model->count($criteria);
$pages = new CPagination($count);
$pages->pageSize = 13;
$pageParams = XUtils::buildCondition($_GET, array('title'));
$pages->params = is_array($pageParams) ? $pageParams : array();
$criteria->limit = $pages->pageSize;
$criteria->offset = $pages->currentPage * $pages->pageSize;
$result = $model->findAll($criteria);
$this->render('ad_index', array('datalist' => $result, 'pagebar' => $pages));
}