|
PHP技巧实例:Smarty+adodb分页示例(2) <!--{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,
|