Used to be the moderator of this class to be paged ~ ~ ~ ~ But recently there is a server is PHP4 version ~ ~ Check the data ~PHP4 does not support the public does not support static and so a large heap ~ ~ ~ so high finger teach ~ The following page class to support PHP4
Ps:constant ("Page_size") is a constant defined in the config file
1, ' prve ' = $page > 1? $page-1:1, ' next ' = $page < $count? $page + 1: $count, ' end ' = $count,); foreach ($d as $k = + $v) {$_get[' page '] = $v; $TPL = Str_replace ($k, Http_build_query ($_get), $TPL); } return $TPL. " Current section ". $page." Page | total ". $count." Page "; }}/* $sql = "..."; $rs = mysql_query ($sql); or $rs = mysql_query ("Select ..."), or the like, and change to include ' paging.php '; $rs = paging::p repare ($sql, Number of rows per page); Write Paging::bar () where a paging bar is required; We can do it */?>.
Reply to discussion (solution)
PHP 4.3.4 through
I don't know your version, but I have a question.
Class Paging {//Adds a method for passing data function para ($na) {static $ar between statically invoked methods, if (func_num_args () = = 1) return $ar [$na]; $ar [$na] = Func_get_arg (1); } function prepare ($sql, $pagesize = ') {$pagesize =constant ("page_size"); $page = isset ($_get[' page '))? $_get[' page ': 1 ; $pageon = ($page-1) * $pagesize; $sql = preg_replace ('/select\s/i ', ' $0sql_calc_found_rows ', $sql). "Limit $pageon, $pagesize"; $rs = mysql_query ($sql); $p = mysql_query (' SELECT found_rows () '); list ($count) = Mysql_fetch_ Row ($p);p Aging::p Ara (' count ', $count);p Aging::p ara (' size ', $pagesize);p Aging::p Ara (' page ', $page); return $rs; } function Bar ($tpl = ') {if (! $tpl) $tpl = ' Home page previous next last '; $count = ceil (paging::p Ara (' count ')/constant ("page_size"); $p Age = Paging::p ara (' page '); unset ($_get[' page '); $d = Array (' Reset ' = 1, ' prve ' = ' $page > 1? $page-1:1, ' next ' = = $page < $count? $page + 1: $count, ' end ' = = $count,), foreach ($d as $k + $v) {$_get[' page '] = $v; $tpl = Str_replace ($k, Http_build_que Ry ($_get), $TPL);} return $TPL. " Current section ". $page." Page | total ". $count." Page "; }}//PHP4 has no http_build_query function, so define an if (! function_exists (' Http_build_query ')): function Http_build_query ($ Formdata, $numeric _prefix= ", $mode =0) {Static $ar = array (); foreach ($formdata as $k = + $v) {if (Is_array ($v)) {if ($mode + +) Http_build_query ($v , $numeric _prefix. ' ['. $k. '] '); else Http_build_query ($v, $k); }else {if ($mode) $ar [] = $numeric _prefix. ' ['. $k. ']= '. UrlEncode ($v); else $ar [] = (Is_numeric ($k)? $numeric _prefix. $k: $k). ' = '. UrlEncode ($v); }} if (--$mode < 0) {$r = join (' & ', $ar); $ar = Array (); return $r; } return '; }endif;
PHP 4.3.4 through
Do not know your version, have a question again PHP code? 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263clas s paging {//Add a method for static calls to the party ...
Now this machine does not have FTP, so go back to test ~ ~ There is a question to ask is to use smarty do backstage, the use of frameset, the results of the page display blank, Baidu after the solution has been checked the path and code (see this article HTTP/s blog.csdn.net/wxlhlh001/article/details/7049938) ..... The result is still display blank page, separate display is OK, for example in the address bar input header.php,menu.php,main.php can display normally ....
I don't know what's wrong with you, but I know that every frame page has its own handler.
I don't know what's wrong with you, but I know that every frame page has its own handler.
Paste part of the code to the ~
The root directory is:
index.php
top.php
menu.php
main.php
The root directory has the Templates folder
The Templates folder has:
Index.html
Top.html
Menu.html
Main.html
index.php
Display ("index.html");? >
top.php
Get_name (); $smarty->assign ("name", $name); $smarty->display ("top.html"); >
menu.php
Display ("menu.html");? >
main.php
Display ("main.html");? >
Index.html
Backstage management--Red theory Research Club
&lt;body&gt;&lt;/body&gt;
http://localhost/admin/menu.php
http://localhost/admin/top.php
These will show up normally.
http://localhost/admin/index.php
Page display blank