PHP技巧:Smarty adodb分页实例
发布时间:2023-10-24 10:11:11 所属栏目:PHP教程 来源:
导读:利用Smarty adodb分页示例, 下面给出的是分页部份的代码。
分页文件:page.lbi
以下为引用的内容:
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<form name="jump" method="post" ac
分页文件:page.lbi
以下为引用的内容:
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<form name="jump" method="post" ac
利用Smarty adodb分页示例, 下面给出的是分页部份的代码。 分页文件:page.lbi 以下为引用的内容: <table width="100%" border="0" cellpadding="0" cellspacing="0" > <form name="jump" method="post" action=""> <tr> <td height="28" align="center" valign="bottom">当前页 <!--{$navi_cM.page}-->/<!--{$navi_cM.pages}--> <!--{if $navi_cM.pages gt 1 && $navi_cM.page ne 1}--> <a href="?<!--{$navi_cM.param}-->&page=1">[ 首页 ]</a> <!--{else}--> [ 首页 ] <!--{/if}--> <!--{if $navi_cM.pages gt 1 && $navi_cM.page ne 1}--> <a href="?<!--{$navi_cM.param}-->&page=<!--{$navi_cM.page-1}-->">[ 上一页 ]</a> <!--{else}--> [ 上一页 ] <!--{/if}--> <!--{if $navi_cM.pages gt 1 && $navi_cM.page ne $navi_cM.pages}--> <a href="?<!--{$navi_cM.param}-->&page=<!--{$navi_cM.page 1}-->">[ 下一页 ]</a> <!--{else}--> [ 下一页 ] <!--{/if}--> <!--{if $navi_cM.pages gt 1 && $navi_cM.page ne $navi_cM.pages}--> <a href="?<!--{$navi_cM.param}-->&page=<!--{$navi_cM.pages}-->">[ 末页 ]</a> <!--{else}--> [ 末页 ] <!--{/if}--> 转到 字串6 <select name="changepage" onchange="re_jump('<!--{$navi_cM.param}-->')"> <!--{html_options options=$navi_cM.option selected=$navi_cM.page}--> </select> </td> </tr> </form> </table> php部份.... 以下为引用的内容: // level E member's product commend list public function product_comm($size = 5){ $pre = $size <> 5 && !empty($_REQUEST['lb']) ? " AND prolb LIKE '%".$_REQUEST['lb']."%' " : ""; $this->where = " judge_flag = 0 AND pubname = '".$_REQUEST['user']."' $pre "; $sql = " SELECT id, pingpai, img, huohao FROM user_proinfo WHERE ".$this->where. " ORDER BY pubtime DESC "; $res = $this->selectRs->SelectLimit($sql, $size, ($this->page - 1) * $size ); $this->NaviPage_cM("`user_proinfo`", $size, $this->where); return $res; } // embed in all must be used cat page function private function NaviPage_cM($table, $size, $where){ $count = $this->selectRs->GetOne("SELECT COUNT(*) FROM $table WHERE $where "); $pages = @ceil($count/$size); for ($i = 0; $i <= $pages; $i ) $arr[] = $i; $navi_cM = array( "option" => $arr, "page" => $this->page, "pages" => $pages, "count" => $count, 字串7 "size" => $size, "param" => $this->param ); $this->tpl->assign("navi_cM", $navi_cM); } (编辑:汽车网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐