當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Paginator::setLink方法代碼示例

本文整理匯總了PHP中Paginator::setLink方法的典型用法代碼示例。如果您正苦於以下問題:PHP Paginator::setLink方法的具體用法?PHP Paginator::setLink怎麽用?PHP Paginator::setLink使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Paginator的用法示例。


在下文中一共展示了Paginator::setLink方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Paginator

$category_var_name = $id;
$category = get_category_by_var_name($category_var_name);
$category_id = $category['id'];
$type_var_name = $extra;
$type_id = get_type_id_by_varname($type_var_name);
$jobsCount = 0;
if ($type_id) {
    $jobsCount = $job->CountJobs($id, $type_id);
} else {
    $jobsCount = $job->CountJobs($id);
}
$paginatorLink = BASE_URL . URL_JOBS . "/{$category_var_name}";
if (isset($type_var_name)) {
    $paginatorLink .= "/{$type_var_name}";
}
$paginator = new Paginator($jobsCount, JOBS_PER_PAGE, @$_REQUEST['p']);
$paginator->setLink($paginatorLink);
$paginator->paginate();
$firstLimit = $paginator->getFirstLimit();
$lastLimit = $paginator->getLastLimit();
$the_jobs = $job->GetPaginatedJobsForCategory($category_id, $firstLimit, JOBS_PER_PAGE, $type_id);
$smarty->assign("pages", $paginator->pages_link);
$smarty->assign('jobs', $the_jobs);
$smarty->assign('jobs_count', $jobsCount);
$smarty->assign('types', get_types());
$smarty->assign('current_category', $category_var_name);
$smarty->assign('current_category_name', $category['name']);
$smarty->assign('seo_title', $category['title']);
$smarty->assign('seo_desc', $category['description']);
$smarty->assign('seo_keys', $category['keywords']);
$template = 'category.tpl';
開發者ID:Kuzy,項目名稱:jobberbase,代碼行數:31,代碼來源:page_category.php

示例2: array

<?php

$the_jobs = array();
$jobCount = $job->getInactiveJobCount();
$paginator = new Paginator($jobCount, JOBS_PER_PAGE, @$_REQUEST['p']);
$paginator->setLink(BASE_URL . 'home');
$paginator->paginate();
$firstLimit = $paginator->getFirstLimit();
$lastLimit = $paginator->getLastLimit();
$the_jobs = $job->GetInactiveJobs($firstLimit, JOBS_PER_PAGE);
$smarty->assign("pages", $paginator->pages_link);
$smarty->assign('jobs', $the_jobs);
$template = 'index.tpl';
開發者ID:zeamxie,項目名稱:jobberbase,代碼行數:13,代碼來源:page_home.php


注:本文中的Paginator::setLink方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。