本文整理汇总了PHP中pager::get_page方法的典型用法代码示例。如果您正苦于以下问题:PHP pager::get_page方法的具体用法?PHP pager::get_page怎么用?PHP pager::get_page使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pager
的用法示例。
在下文中一共展示了pager::get_page方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_data_bycond
/**
* name: get_list
* params:
*/
public function get_data_bycond($field, $filters, $sortby = sorting::DEFAULT_SORT, $sortdir = sorting::SORT_DIR_DEFAULT, $page = null, $count = 10)
{
$cond = $this->hash_filters($filters);
if (!$this->cache_enabled || !$this->filtered_data[$field][$cond]) {
$dir = $this->conf->paths['storage'];
if (is_file($path = $this->conf->paths['lists'] . "/" . $this->conf->lists_paths[$field] . file_storage_config::IVAL_PF) && file_exists($path)) {
$data = explode($this->separator2, file_get_contents($path));
} else {
return $this->filtered_data[$field][$cond] = null;
}
if ($sortdir == sorting::SORT_DIR_DESC) {
rsort($data);
}
foreach ($data as $tmpdata) {
$tmp = explode($this->separator1, rtrim($tmpdata));
$obval = $tmp[0];
$obid = $tmp[1];
$add = false;
if (is_array($filters)) {
foreach ($filters as $filter) {
if ($filter instanceof file_storage_filter) {
$add = $add || $this->check_cond($filter, $obval);
}
}
} elseif ($filters instanceof file_storage_filter) {
$add = $add || $this->check_cond($filters, $obval);
if ($this->need_break($filters, $obval, $sortdir)) {
break;
}
}
if ($add) {
$file = file_get_contents($dir . "/" . rtrim($obid));
$this->filtered_data[$field][$cond][] = unserialize($file);
}
}
}
$pager = new pager(count($this->filtered_data[$field][$cond]), $count);
return $pager->get_page($this->filtered_data[$field][$cond], $page);
}