本文整理汇总了PHP中source\LuLu::getPagedRows方法的典型用法代码示例。如果您正苦于以下问题:PHP LuLu::getPagedRows方法的具体用法?PHP LuLu::getPagedRows怎么用?PHP LuLu::getPagedRows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类source\LuLu
的用法示例。
在下文中一共展示了LuLu::getPagedRows方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
$query = Content::leftJoinWith('takonomy');
$locals = LuLu::getPagedRows($query, ['orderBy' => 'created_at desc', 'pageSize' => 6]);
$dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 5]]);
$locals['dataProvider'] = $dataProvider;
return $this->render('index', $locals);
}
示例2: getPagedContents
/**
*
* @param string $where
* @param string $orderBy
* @param number $pageSize
* @param array $options
* --recommend
* --headline
* --sticky
* --flag
* --is_pic
* --content_type
* --page
* --taxonomy:array or number
*
* @return array:['rows','pager']
*/
public static function getPagedContents($where = null, $orderBy = null, $pageSize = 10, $options = [])
{
$query = self::buildContentQuery($where, $options);
$query->joinWith('taxonomy', true, 'LEFT JOIN');
$page = isset($options['page']) ? $options['page'] : null;
$orderBy = empty($orderBy) ? 'created_at desc' : $orderBy;
$locals = LuLu::getPagedRows($query, ['page' => $page, 'pageSize' => $pageSize, 'orderBy' => $orderBy]);
return $locals;
}
示例3: getPagedContents
public static function getPagedContents($where = null, $pageSize = 10)
{
$query = Content::leftJoinWith('taxonomy');
if (!empty($where)) {
$query->andWhere($where);
}
$locals = LuLu::getPagedRows($query, ['orderBy' => 'created_at desc', 'pageSize' => $pageSize]);
return $locals;
}
示例4: actionIndex
public function actionIndex()
{
$query = Content::leftJoinWith('takonomy');
$locals = LuLu::getPagedRows($query, [
'orderBy' => 'created_at desc',
'pageSize' => 6
]);
return $this->render('index', $locals);
}
示例5: actionList
public function actionList()
{
$takonomy = LuLu::getGetValue('takonomy');
$takonomyModel = Takonomy::getOneOrDefault($takonomy);
$query = Content::find();
$query->where(['content_type' => $this->content_type]);
$query->andFilterWhere(['takonomy_id' => $takonomy]);
$locals = LuLu::getPagedRows($query, ['orderBy' => 'created_at desc', 'pageSize' => 10]);
$locals['takonomyModel'] = $takonomyModel;
return $this->render('list_default', $locals);
}
示例6: actionList
/**
* 列表页
* @param integer $taxonomy
* @return \yii\base\string
*/
public function actionList($taxonomy = -1)
{
$query = Content::findPublished(['content_type' => $this->content_type]);
if (intval($taxonomy) > 0) {
$query->andFilterWhere(['taxonomy_id' => intval($taxonomy)]);
}
$taxonomyModel = $this->taxonomyService->getTaxonomyById($taxonomy);
LuLu::setViewParam(['taxonomyModel' => $taxonomyModel]);
$vars = $this->getListVars($taxonomyModel);
$locals = LuLu::getPagedRows($query, ['orderBy' => 'created_at desc', 'pageSize' => $vars['pageSize']]);
$locals['taxonomyModel'] = $taxonomyModel;
$this->layout = $vars['layout'];
return $this->render($vars['view'], $locals);
}
示例7: actionIndex
public function actionIndex()
{
$taxonomy = LuLu::getGetValue('taxonomy');
$query = Content::find();
$query->where(['content_type' => $this->content_type]);
$query->andFilterWhere(['taxonomy_id' => $taxonomy]);
if ($taxonomy === null) {
$taxonomyModel = Taxonomy::findOne(['id' => $taxonomy]);
} else {
$taxonomyModel = ['id' => null, 'name' => '所有'];
}
$locals = LuLu::getPagedRows($query, ['orderBy' => 'created_at desc', 'pageSize' => 10]);
$locals['taxonomyModel'] = $taxonomyModel;
return $this->render('index', $locals);
}