Smarty 分页

1 <div id="pagelist" class="clearfix">
2     <a href="/canadian-sailing-team-p191117&preview=1&pager=1">First</a> //第一页
3     {if $pagerInfo.currentPage > 1} //如果当前页大于1,则有pre链接
4         <a href="/canadian-sailing-team-p191117&preview=1&pager=span>Pre</span></a>
5     {else}
6         <span>Pre</span>
7     {/if}
8 index+1} //index从0开始计数
10         <a href="/canadian-sailing-team-p191117&preview=1&pager={$pindex}"><span {if $pagerInfo.currentPage == $pindex} class="cur" {/if}>{$pindex}</span></a>
11     {/section}
12  {if $pagerInfo.currentPage < $pagerInfo.pageCount}//如果当前页小于总页数,则有next链接
13         <a href="/canadian-sailing-team-p191117&preview=1&pager=span>Next</span></a>
14     {else}
15         <span>Next</span>
16     {/if}
17     <a href="/canadian-sailing-team-p191117&preview=1&pager={$pagerInfo.pageCount}">Last</a>
18 </div>

时间: 2024-08-08 05:38:30

Smarty 分页的相关文章

smarty 分页查询

对查出的数据进行分页,并添加查询 在main.php和main.html两个页面操作: 后台:main.php 1 <?php 2 include("../init.inc.php"); 3 4 include("../../DBDA.class.php"); 5 $db = new DBDA(); 6 include("../../page.class.php"); 7 8 //造查询条件 9 $tj = " 1=1 "

无刷新分页技术,Ajax+smarty

这里运用Smarty模板,更简单 本文主要的技术:AJAX,PHP,Smarty,另外自己封装了一个很简单的类 类: (function(){    function $(id) {        return document.getElementById(id);    }    $.init=function() {        try{return new XMLHttpRequest();}catch(e){};        try{return new ActiveXObject

smarty+php+ajax 简单无刷新分页

简介 分页,无非就是从数据库中获得我们想查询的数据,再加以处理即可! ① 确定数据总数($count) ② 每页显示数据条数($pageSize) ③ 分多少页($pageCount) ④ 上一页($pagePrev) ⑤ 下一页($pageNext) ⑥ 判断越界问题 ⑦ 偏移量($offset) ⑧ sql语句($sql = "select * from goods limit $offset,$pageSize";) 简单归简单,我们还得考虑实际的应用.例如:如果你正在土豆网看&

smarty模板调数据库并做添加删除修改和分页

smarty模板只要就是实现分离效果所以每个功能都需要两个页面一个是HTML  和 PHP  两部分组成 使用smarty模板要在main文件夹下面创建login.php文本,要用smarty模板首先引入入口文件, <?php include("../init.inc.php"); //引入入口文件 //var_dump($smarty);// $smarty->display("login.html");//用来在模板显示用户看到的内容 登录页面在sm

夺命雷公狗---Smarty NO:21 分页

在smarty里面写一个分页 demo6.php代码示例: <?php header(“Content-Type:text/html;charset=utf-8″); require “smarty/Smarty.class.php”; $smarty = new Smarty(); //连接数据库 mysql_connect(“localhost”,’root’,”); mysql_query(‘use xsphp’); mysql_query(‘set names utf8′); //读取所

Smarty的分页实现

Smarty中的分页有很多方法.1.使用Smarty的分页插件,如Pager,pagnition,sliding_page等,不过感觉都不是太好,几乎都有一些Bug.有兴趣试用和自己去改进的朋友可以看看:http://smarty.php.net/contribs/plugins/view.php/function.pager.phphttp://www.phpinsider.com/smarty-forum/viewtopic.php?t=2327http://www.phpinsider.c

第一个smarty例子--分页显示数据

模板页index.tpl: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv=&qu

PHP Smarty 页面静态化加分页和缓存控制

PHP页面 <?php  //打开输出控制缓冲 ob_start(); //新建模板文件 $file = "./cache/newindex{$_GET['page']}.html"; $cachetime = 10; const  DSN = 'mysql:host=localhost;dbname=test'; const   DBUSER = 'root'; const   DBPWD     = 'root'; //模板不存在或者超过缓存时间才生成缓存模板 if(!fil

Smarty的应用

smarty模板的核心是一个类,下载好的模板中有这么几个重要的文件夹 (1)libs核心文件夹(2)int.inc.php这是入口文件(3)plugins:自己写的插件文件夹(4)templates_c:存放编译好的文件(5)int.inc.php这是入口文件(6)定义好常量:不能修改 二.怎么用模板? 模板页面1.引入模板的入口文件include("入口文件路径位置"); 2.直接用对象提供一个方法:向模板中注册变量的方法(assign(名字,值)$smarty->assign