我想在用户搜索某个项目时在我的网站中添加分页。我尝试了以下代码:
//Array Declaration//
$pages = array();
$userlist = array();
//paging variable//
$userlist_pg = $_GET['list_pg'];
if(empty($userlist_pg))
$userlist_pg = 1;
else
$userlist_pg=$_GET['list_pg'];
$userlist_limit = 10;//ADMIN_ITEMLIST_PER_PAGE;
$userlist_start = (($userlist_pg - 1) * $userlist_limit );
$userlist_currentpage = $userlist_pg;
$userlist_back = $userlist_pg-1;
$userlist_next = $userlist_pg + 1;
$query_string = "select cms_id,cms_variable,cms_page_name,cms_last_edited from tbl_cms";
//Paging variables start from here-------------------------
$orderlist = array();
$paging = new PagedResults();
$paging->TotalResults = table_query_count($query_string);
$InfoArray = $paging->InfoArray();
$query_string.=" LIMIT ".$InfoArray["MYSQL_LIMIT1"].", ".$InfoArray["MYSQL_LIMIT2"];
$PageVarName = 'client_page';
$smarty->assign("page_display", getpagelist($InfoArray["CURRENT_PAGE"],$InfoArray["PREV_PAGE"],$InfoArray["NEXT_PAGE"],$InfoArray["TOTAL_PAGES"],$InfoArray["Second_next"],$InfoArray["third_next"],$InfoArray["fourth_next"],$PageVarName));
$smarty->assign("currentpage",$InfoArray["CURRENT_PAGE"]);
$smarty->assign("total_pages",$InfoArray["TOTAL_PAGES"]);
//Paging variables end here-------------------------
它会出现以下错误。
在第110行的/home/www/jobplacement4u.com/hungry_uni/modules/search/action/search_action.php中调用未定义的函数table_query_count()
第30行的/home/www/jobplacement4u.com/hungry_uni/modules/search/action/search_action.php中找不到“PagedResults”类
在第111行的/home/www/jobplacement4u.com/hungry_uni/modules/search/action/search_action.php中调用未定义的方法PagedResults :: InfoArray()
答案 0 :(得分:0)
您似乎忘记了包含函数table_query_count
和类PagedResults
的定义的文件