本文整理汇总了PHP中Pager::show方法的典型用法代码示例。如果您正苦于以下问题:PHP Pager::show方法的具体用法?PHP Pager::show怎么用?PHP Pager::show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pager
的用法示例。
在下文中一共展示了Pager::show方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchWidgetData
public function fetchWidgetData($view, $block = '')
{
$widgetData = array();
$blockCfgKey = $block ? $view . '_' . $block : $view;
$blockCfg = $this->_siteConfig['blockCfg'][$blockCfgKey];
$blockNum = $this->_siteConfig['widgetCfg']['blockNum'];
switch ($view) {
case 'slider':
//理财故事
//理财故事
case 'btslider':
$widgetData[$block] = array('blockName' => $block, 'items' => $this->_siteConfig['slider'][$block]);
break;
case 'dailyword':
$dailyword['title'] = '天天词汇';
$dailyword['word'] = Tags::findFirst(array("conditions" => "is_cidian = ?1", "bind" => array(1 => 1)))->toArray();
$widgetData = $dailyword;
break;
case 'content':
switch ($block) {
case 'node':
$content = TreeData::findFirst($this->_params['nid'])->toArray();
$content['content'] = htmlspecialchars_decode($content['content']);
$widgetData[$block]['content'] = $content;
break;
case 'tag':
$content = Tags::findFirst($this->_params['tid'])->toArray();
$content['content'] = htmlspecialchars_decode($content['description']);
$content['title'] = $content['name'];
$widgetData[$block]['content'] = $content;
break;
case 'static':
$static_content = TreeStruct::findFirst(array("conditions" => "pid = ?1", "bind" => array(1 => $this->_params['nid']), 'order' => 'lft asc'));
$content = array();
if ($static_content) {
$content['title'] = $static_content->TreeData->title;
$content['content'] = htmlspecialchars_decode($static_content->TreeData->content);
}
$widgetData[$block]['blockName'] = $block;
$widgetData[$block]['content'] = $content;
break;
default:
break;
}
break;
case 'cidian':
$cidianCloudNum = $this->_siteConfig['widgetCfg']['cidianCloudNum'];
$tags = Tags::fetchCidiansCloud($cidianCloudNum);
$widgetData = $tags;
break;
case 'hangqing':
case 'lilv':
case 'tool':
break;
case 'taglist':
$taglist = array();
$itemPer = $this->_siteConfig['widgetCfg']['listItemPer'];
$start = ($this->_params['p'] - 1) * $itemPer;
if ($this->_params['tagPrefix']) {
$conditions = 'pinyinPrefix="' . $this->_params['tagPrefix'] . '" and is_cidian=1';
} else {
$conditions = 'is_cidian=1';
}
$taglist['items'] = Tags::find(array('conditions' => $conditions, 'order' => 'id desc', 'limit' => array('number' => $itemPer, 'offset' => $start)))->toArray();
$totalTags = Tags::count($conditions);
$params = array('total_rows' => $totalTags, 'now_page' => $this->_params['p'], 'list_rows' => $itemPer);
$pagerLib = new Pager($params);
$pager = $pagerLib->show(3);
$taglist['pager'] = $pager;
// echo '<pre>';print_r($taglist);echo '</pre>';
$widgetData = $taglist;
break;
case 'taglist_header':
$optRanges = array(97, 122);
$options = array();
$options[] = '0-9';
for ($i = $optRanges[0]; $i <= $optRanges[1]; $i++) {
$options[] = chr($i);
}
$widgetData = $options;
break;
case 'list':
switch ($block) {
case 'node':
$nodeLists = array();
$itemPer = $this->_siteConfig['widgetCfg']['listItemPer'];
$start = ($this->_params['p'] - 1) * $itemPer;
$temNodes = TreeStruct::find(array('conditions' => 'lft>?1 and rgt<?2 and type=:type:', 'bind' => array(1 => $this->_params['node']->lft, 2 => $this->_params['node']->rgt, 'type' => 'article'), 'limit' => array('number' => $itemPer, 'offset' => $start), 'order' => 'id desc'));
$nodes = array();
foreach ($temNodes as $key => $temNode) {
$treeData = $temNode->TreeData->toArray();
$nodes[$key] = $temNode->toArray();
$nodes[$key]['TreeData'] = $treeData;
}
$nodes = TreeStruct::addNodesAttr($nodes, array('menu' => true, 'menuLevel' => 1));
$totalNodes = TreeStruct::count(array('conditions' => 'lft>?1 and rgt<?2 and type=:type:', 'bind' => array(1 => $this->_params['node']->lft, 2 => $this->_params['node']->rgt, 'type' => 'article')));
$params = array('total_rows' => $totalNodes, 'now_page' => $this->_params['p'], 'list_rows' => $itemPer);
$pagerLib = new Pager($params);
$pager = $pagerLib->show(3);
$nodeLists['title'] = $this->_params['node']->TreeData->title;
//.........这里部分代码省略.........
示例2: admin_action
/**
* Страница управления сниппетами
*/
public function admin_action()
{
$this->hookAdminMenu();
$snippet = new Code_Snippet();
$snippet->order('id', 'DESC');
if ($q = $this->input->get('q')) {
$snippet->like('name', $q)->or_like('code', $q);
}
template('Search/templates/form', array('action' => ''))->show();
$pager = new Pager(array('count' => $snippet->countAll(), 'per_page' => 20, 'base' => l('/admin/code')));
if ($snippets = $snippet->findAll()) {
$tpl = new Template('Code/templates/list');
$tpl->snippets = $snippets;
$tpl->show();
$pager->show();
} else {
event('empty');
}
}
示例3: explode
$cidStrs = '';
$cidArrs = explode(',', $cids);
foreach ($categories as $key => $category) {
if (in_array($category['id'], $cidArrs)) {
$categories[$key]['selected'] = true;
$cidStrs .= $cidStrs ? ',' . $category['title'] : '';
}
}
$filterKeys .= ' 分类:' . $cidStrs;
}
if ($tids) {
$tidStrs = '';
$tidArrs = explode(',', $tids);
foreach ($tags as $key => $tag) {
if (in_array($tag['id'], $tidArrs)) {
$tags[$key]['selected'] = true;
$tidStrs .= $tidStrs ? ', 排序:' . $tag['name'] : '';
}
}
$filterKeys .= ' 标签:' . $tidStrs;
}
$filterKeys .= $order != 'id' ? ' 排序: ' . $order : '';
$smarty->assign('categories', $categories);
$smarty->assign('tags', $tags);
$smarty->assign('filterKeys', $filterKeys);
//pager
$params = array('total_rows' => $totalArticles, 'now_page' => $page, 'list_rows' => $item_per_page);
$pagerLib = new Pager($params);
$pager = $pagerLib->show(3);
$smarty->assign('pager', $pager);
$smarty->display('script/articles.html');