【发布时间】:2013-09-16 19:42:29
【问题描述】:
我必须在分页页面的中心显示一个块 喜欢页面有 10 个项目的列表
我们如何在页面上将其拆分为 2 部分,以便在每 5 个项目之后 - 我可以显示一个启用 Javascript 的自定义块,以便将我们的自定义脚本放在那里
寻呼逻辑
//logic of count
$model = &$this->getModel();
$modelCategoryList = &$this->getModel( 'list' );
$newslistTotal = $modelCategoryList->get_news_list_total();
$page = (isset($_REQUEST['page'])!="")? $_REQUEST['page'] : 1;
$records_per_page=10;
$offset = ($page-1) * $records_per_page;
//display count on the pager page based on logic
$newslist = $modelCategoryList->get_news_list($offset,$records_per_page);
$this->assignRef('newslist' , $newslist);
查看表单
if(count($this->newslist) >0){
foreach($this->newslist as $newslist)
{
$list .='<h2><strong>'.$newslist->make.' - '.$newslist->model.'</strong></h2>
<p>'.$newslist->n_month.' - '.$newslist->year.'</p>
<p>'.$newslist->list_description.'</p>
<p></p><hr/>';
}
}else{
$list='<div>No Listings.</div>';
}
?>
<?php echo $list?>
通过上述逻辑 - 项目在页面上列出,并进一步使用寻呼机逻辑给出页码。
如何实现点赞 这样所有包含 10 个列表的页面 可以回显
<?php echo $list1?> (of first 5 entries)
<custom script> ........ </custom script>
<?php echo $list2?> (of balance 5 entries)
编辑
【问题讨论】:
标签: php pagination logic