页面分类
来源:互联网 发布:中山大学网络新ip 编辑:程序博客网 时间:2024/05/21 06:26
public function index($p=1){
$modle=D('News');
$limit=($p-1)*10;//每页显示的数目
$news=$modle->limit("$limit,10")->order('create_time desc')->select();
$count= $modle->count();//算出数据库的数目
$total= ceil($count/10);//总页数
//偏移量开始的位置
$start = $p - 2;
//偏移量结束的位置
$end = $p + 2;
if($p<1)$p=1;
if ($start < 1) {
$start = 1;
$end = min([$total, 5]); //取显示数量与总页数的最小数
}
if($end>$total){
$end=$total;
$start= max($total-4,1);
}
$this->assign([
'news'=>$news,
'total'=>$total,
'start'=>$start,
'end'=>$end,
'p'=>$p,
]);
$this->display();
$modle=D('News');
$limit=($p-1)*10;//每页显示的数目
$news=$modle->limit("$limit,10")->order('create_time desc')->select();
$count= $modle->count();//算出数据库的数目
$total= ceil($count/10);//总页数
//偏移量开始的位置
$start = $p - 2;
//偏移量结束的位置
$end = $p + 2;
if($p<1)$p=1;
if ($start < 1) {
$start = 1;
$end = min([$total, 5]); //取显示数量与总页数的最小数
}
if($end>$total){
$end=$total;
$start= max($total-4,1);
}
$this->assign([
'news'=>$news,
'total'=>$total,
'start'=>$start,
'end'=>$end,
'p'=>$p,
]);
$this->display();
}
2 0
- 页面分类
- Blog的页面分类
- wordpress自定义分类页面
- 高仿京东分类页面实现
- 安卓 分类 页面
- Bottobar 实现分类页面
- 把静态页面分分类
- html5 商品分类页面效果
- 实现仿电商app分类页面
- WordPress分类页面获取当前分类的ID
- WordPress分类页面获取当前分类的ID
- 多级别分类的页面显示
- 同一个页面内根据分类查询
- 分类页面:取出类下边的文章
- 分类页面:repeater控件的应用
- magento 管理分类中页面布局设置
- ecshop 调试分类页面技巧 debug_print_backtrace
- 在Magento页面左边增加分类菜单
- 生成器和列表解析总结及测试
- 空间统计说历史:奥德修斯的归家之路
- 清除行列
- java线程笔记
- OpenGL纹理详解(下)
- 页面分类
- Lowest Common Multiple Plus
- Hadoop矩阵相乘
- 枚举、结构、类
- Unslider – 轻量的响应式 jQuery 内容滑块插件
- 先验与后验概率
- windows下的php、nginx、mysql配置记录和问题汇总
- OpenLayers中layer图层概念和实践
- c++第三次作业