本文整理汇总了PHP中Paging::getHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP Paging::getHtml方法的具体用法?PHP Paging::getHtml怎么用?PHP Paging::getHtml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paging
的用法示例。
在下文中一共展示了Paging::getHtml方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
/**
* 首页
*
* @author mrmsl <msl-138@163.com>
* @date 2013-04-28 17:14:18
*
* @return void 无返回值
*/
public function indexAction()
{
$page_size = 60;
$total = $this->_model->table(TB_TAG)->count('DISTINCT tag');
$page_info = Filter::page($total, 'page', $page_size);
$page = $page_info['page'];
$page_one = $page < 2;
$tag_arr = $this->_model->table(TB_TAG)->order('searches DESC')->field('DISTINCT `tag`')->limit($page_info['limit'])->select();
$paging = new Paging(array('_url_tpl' => BASE_SITE_URL . 'tag/page/\\1.shtml', '_total_page' => $page_info['total_page'], '_now_page' => $page, '_page_size' => $page_size));
$o = $this->getViewTemplate()->assign(array('web_title' => L('TAG'), 'tag_arr' => $tag_arr, 'paging' => $paging->getHtml(), 'page' => $page_one ? '' : $page));
$this->_display(null, null, $page);
}
示例2: _fetchBlog
/**
* 渲染博客列表
*
* @author mrmsl <msl-138@163.com>
* @date 2013-04-28 16:55:45
*
* @param string|array $cate_info 数组为分类,否则为标签
*
* @return void 无返回值
*/
private function _fetchBlog($cate_info = null)
{
if (is_array($cate_info)) {
//分类
$is_tag = false;
$cate_id = $cate_info['cate_id'];
$table = TB_BLOG;
$where = array('b.is_delete' => 0, 'b.is_issue' => 1);
if ($cate_id) {
//category.shtml
$where['b.cate_id'] = array('IN', $this->_getChildrenIds($cate_id));
}
$url_tpl = str_replace('.shtml', '/page/\\1.shtml', $cate_info['link_url']);
$cache_flag = $cate_id;
$total = $this->_model->table(TB_BLOG)->alias('b')->where($where)->count();
$this->_model->alias('b');
//b.title
} else {
//标签
$this->_model->table(TB_TAG)->where(array('tag' => $cate_info))->setInc('searches');
//搜索次数+1
$is_tag = true;
$table = TB_BLOG . ' AS b JOIN ' . TB_TAG . ' AS t ON t.blog_id=b.blog_id';
$where = array('t.tag' => array('IN', $cate_info), 'b.is_delete' => 0, 'b.is_issue' => 1);
$url_tpl = BASE_SITE_URL . 'tag/' . urlencode($cate_info) . '/page/\\1.shtml';
$cache_flag = md5(strtolower($cate_info));
$total = $this->_model->table(TB_BLOG)->alias('b')->join(' JOIN ' . TB_TAG . ' AS t ON b.blog_id=t.blog_id')->where($where)->count('DISTINCT b.blog_id');
}
$page_info = Filter::page($total, 'page', PAGE_SIZE);
$page = $page_info['page'];
$page_one = $page < 2;
$blog_arr = $this->_model->table($table)->where($where)->order('b.blog_id DESC')->limit($page_info['limit'])->field('b.blog_id,b.title,b.link_url,b.cate_id,b.add_time,b.summary,b.seo_keyword,b.seo_description')->select();
$paging = new Paging(array('_url_tpl' => $url_tpl, '_total_page' => $page_info['total_page'], '_now_page' => $page, '_page_size' => PAGE_SIZE));
$o = $this->getViewTemplate($page_one && !$is_tag ? 'build_html' : null)->assign(array('blog_arr' => $blog_arr, 'paging' => $paging->getHtml(), 'page' => $page_one ? '' : $page));
if ($is_tag) {
//标签
$o->assign(array('web_title' => $cate_info . TITLE_SEPARATOR . L('TAG'), 'tag' => $cate_info, 'seo_keywords' => $cate_info));
} else {
//分类
$o->assign(array('web_title' => $cate_id ? $this->nav($cate_id, 'cate_name', null, TITLE_SEPARATOR) : $cate_info['cate_name'], 'cate_info' => $cate_info, 'tag' => ''));
}
$content = $o->fetch(CONTROLLER_NAME, ACTION_NAME, $cache_flag . '-' . $page);
if ($page_one && !$is_tag) {
$filename = str_replace(BASE_SITE_URL, WWWROOT, $cate_info['link_url']);
new_mkdir(dirname($filename));
//file_put_contents($filename, $content);
}
echo $content;
}
示例3: indexAction
/**
* 首页
*
* @author mrmsl <msl-138@163.com>
* @date 2013-02-21 13:30:55
*
* @return void 无返回值
*/
public function indexAction()
{
$total = $this->_model->count();
$page_info = Filter::page($total, 'page', PAGE_SIZE);
$page = $page_info['page'];
$page_one = $page < 2;
$blog_arr = $this->_model->order('blog_id DESC')->limit($page_info['limit'])->select();
$paging = new Paging(array('_url_tpl' => BASE_SITE_URL . 'miniblog/page/\\1.shtml', '_total_page' => $page_info['total_page'], '_now_page' => $page, '_page_size' => PAGE_SIZE));
$o = $this->getViewTemplate($page_one ? 'build_html' : null)->assign(array('web_title' => L('MINIBLOG'), 'blog_arr' => $blog_arr, 'paging' => $paging->getHtml(), 'page' => $page_one ? '' : $page));
$content = $o->fetch(CONTROLLER_NAME, ACTION_NAME, $page);
if ($page_one) {
$filename = WWWROOT . 'miniblog.shtml';
//file_put_contents($filename, $content);
}
echo $content;
}
示例4: indexAction
/**
* 首页
*
* @author mrmsl <msl-138@163.com>
* @date 2013-02-21 13:44:11
*
* @return void 无返回值
*/
public function indexAction()
{
$total = $this->_model->table(TB_COMMENTS)->where($where = 'type=' . COMMENT_TYPE_GUESTBOOK . ' AND status=' . COMMENT_STATUS_PASS . ' AND parent_id=0')->count();
$page_info = Filter::page($total, 'page', PAGE_SIZE);
$page = $page_info['page'];
$page_one = $page < 2;
$guestbook_arr = $this->_model->table(TB_COMMENTS)->where($where)->order('last_reply_time DESC')->limit($page_info['limit'])->select();
$paging = new Paging(array('_url_tpl' => BASE_SITE_URL . 'guestbook/page/\\1.shtml', '_total_page' => $page_info['total_page'], '_now_page' => $page, '_page_size' => PAGE_SIZE));
$o = $this->getViewTemplate($page_one ? 'build_html' : null)->assign(array('web_title' => L('GUESTBOOK'), 'guestbook_html' => $this->_getRecurrsiveComments($guestbook_arr), 'paging' => $paging->getHtml(), 'page' => $page_one ? '' : $page));
$content = $o->fetch(CONTROLLER_NAME, ACTION_NAME, $page);
if ($page_one) {
$filename = WWWROOT . 'guestbook.shtml';
//file_put_contents($filename, $content);
}
echo $content;
}