本文整理汇总了PHP中URL::getCurrentPaginationPage方法的典型用法代码示例。如果您正苦于以下问题:PHP URL::getCurrentPaginationPage方法的具体用法?PHP URL::getCurrentPaginationPage怎么用?PHP URL::getCurrentPaginationPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URL
的用法示例。
在下文中一共展示了URL::getCurrentPaginationPage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: listing
/**
* Lists entries based on passed parameters
*
* @return array|string
*/
public function listing()
{
// grab common parameters
$settings = $this->parseCommonParameters();
// grab content set based on the common parameters
$content_set = $this->getContentSet($settings);
// limit
$limit = $this->fetchParam('limit', null, 'is_numeric');
$offset = $this->fetchParam('offset', 0, 'is_numeric');
$paginate = $this->fetchParam('paginate', true, null, true, false);
if ($limit || $offset) {
if ($limit && $paginate && !$offset) {
// pagination requested, isolate the appropriate page
$content_set->isolatePage($limit, URL::getCurrentPaginationPage());
} else {
// just limit
$content_set->limit($limit, $offset);
}
}
// check for results
if (!$content_set->count()) {
return Parse::template($this->content, array('no_results' => true));
}
return Parse::tagLoop($this->content, $content_set->get(), true, $this->context);
}
示例2: map_listing
/**
* List entries
*/
public function map_listing()
{
// parse settings
$settings = $this->parseParameters();
// check for valid center point
if (preg_match(Pattern::COORDINATES, $settings['center_point'], $matches)) {
$settings['starting_latitude'] = $matches[1];
$settings['starting_longitude'] = $matches[2];
}
// get related content
$content_set = $this->getContentSet($settings);
// limit
$limit = $this->fetchParam('limit', null, 'is_numeric');
$offset = $this->fetchParam('offset', 0, 'is_numeric');
$paginate = $this->fetchParam('paginate', true, null, true, false);
if ($limit || $offset) {
if ($limit && $paginate && !$offset) {
// pagination requested, isolate the appropriate page
$content_set->isolatePage($limit, URL::getCurrentPaginationPage());
} else {
// just limit
$content_set->limit($limit, $offset);
}
}
$content_set->prepare(false, true);
$content = $content_set->get();
return $this->buildScript($content, $settings);
}
示例3: listing
/**
* Lists entries based on passed parameters
*
* @return array|string
*/
public function listing()
{
$folders = $this->fetchParam('folder', $this->fetchParam('folders', ltrim($this->fetchParam('from', URL::getCurrent()), "/")));
$folders = $folders === "/" ? "" : $folders;
if ($this->fetchParam('taxonomy', false, null, true, null)) {
$taxonomy_parts = Taxonomy::getCriteria(URL::getCurrent());
$taxonomy_type = $taxonomy_parts[0];
$taxonomy_slug = Config::get('_taxonomy_slugify') ? Slug::humanize($taxonomy_parts[1]) : urldecode($taxonomy_parts[1]);
$content_set = ContentService::getContentByTaxonomyValue($taxonomy_type, $taxonomy_slug, $folders);
} else {
$content_set = ContentService::getContentByFolders($folders);
}
// filter
$content_set->filter(array('show_all' => $this->fetchParam('show_hidden', false, null, true, false), 'since' => $this->fetchParam('since'), 'until' => $this->fetchParam('until'), 'show_past' => $this->fetchParam('show_past', TRUE, NULL, TRUE), 'show_future' => $this->fetchParam('show_future', FALSE, NULL, TRUE), 'type' => 'pages', 'conditions' => trim($this->fetchParam('conditions', ""))));
// sort
$content_set->sort($this->fetchParam('sort_by', 'order_key'), $this->fetchParam('sort_dir'));
// grab total entries for setting later
$total_entries = $content_set->count();
// limit
$limit = $this->fetchParam('limit', null, 'is_numeric');
$offset = $this->fetchParam('offset', 0, 'is_numeric');
$paginate = $this->fetchParam('paginate', true, null, true, false);
if ($limit || $offset) {
if ($limit && $paginate && !$offset) {
// pagination requested, isolate the appropriate page
$content_set->isolatePage($limit, URL::getCurrentPaginationPage());
} else {
// just limit
$content_set->limit($limit, $offset);
}
}
// manually supplement
$content_set->supplement(array('total_found' => $total_entries));
// check for results
if (!$content_set->count()) {
return array('no_results' => true);
}
// if content is used in this entries loop, parse it
$parse_content = (bool) preg_match(Pattern::USING_CONTENT, $this->content);
return Parse::tagLoop($this->content, $content_set->get($parse_content));
}
示例4: search
/**
* Search over data
*
* @return string
*/
public function search()
{
// determine configuration
$dataset = $this->fetch('dataset', null, false, false, false);
$parameters = $this->gatherParameters();
$config = $this->tasks->loadDataset($dataset, $parameters);
// short-circuit this if no query
if (!trim($config['query'])) {
return Parse::tagLoop($this->content, array(array('no_query' => true, '_query' => '')));
}
// do search
$output = $this->tasks->lookUp($config['query'], $config);
$total_found = count($output);
// limit if we need to
if ($config['limit'] || $config['offset']) {
if ($config['limit'] && $config['paginate'] && !$config['offset']) {
// pagination requested, isolate the appropriate page
$count = count($output);
$page = URL::getCurrentPaginationPage();
// return the last page of results if $page is out of range
if (Config::getFixOutOfRangePagination()) {
if ($config['page_limit'] && $page > $config['page_limit']) {
$page = $config['page_limit'];
} elseif ($config['limit'] * $page > $count) {
$page = ceil($count / $config['limit']);
} elseif ($page < 1) {
$page = 1;
}
}
$offset = ($page - 1) * $config['limit'];
$output = array_slice($output, $offset, $config['limit']);
} else {
// just limit or offset
$output = array_slice($output, $config['offset'], $config['limit']);
}
}
// supplement with first, last, etc.
$output = $this->tasks->supplement($output, array('total_found' => $total_found));
return Parse::tagLoop($this->content, $output);
}
示例5: map
/**
* Displays entries on a map
*
* @return string
*/
public function map()
{
// check for valid center point
if (!preg_match(Pattern::COORDINATES, $this->fetchParam('center_point'), $matches)) {
print_r($this->fetchParam('center_point'));
$this->log->error("Could not create map, invalid center point coordinates given");
return NULL;
} else {
$latitude = $matches[1];
$longitude = $matches[2];
}
// pop-up template
$pop_up_template = NULL;
// check for a valid pop_up template
if (preg_match_all("/(?:\{\{\s*pop_up\s*\}\})\s*(.*)\s*(?:\{\{\s*\/pop_up\s*\}\})/ism", $this->content, $matches) && is_array($matches[1]) && isset($matches[1][0])) {
$pop_up_template = trim($matches[1][0]);
}
$folders = $this->fetchParam('folder', ltrim($this->fetchParam('from', URL::getCurrent()), "/"));
if ($this->fetchParam('taxonomy', false, null, true, null)) {
$taxonomy_parts = Taxonomy::getCriteria(URL::getCurrent());
$taxonomy_type = $taxonomy_parts[0];
$taxonomy_slug = Config::get('_taxonomy_slugify') ? Slug::humanize($taxonomy_parts[1]) : urldecode($taxonomy_parts[1]);
$content_set = ContentService::getContentByTaxonomyValue($taxonomy_type, $taxonomy_slug, $folders);
} else {
$content_set = ContentService::getContentByFolders($folders);
}
// filter
$content_set->filter(array(
'show_hidden' => $this->fetchParam('show_hidden', false, null, true, false),
'show_drafts' => $this->fetchParam('show_drafts', false, null, true, false),
'since' => $this->fetchParam('since'),
'until' => $this->fetchParam('until'),
'show_past' => $this->fetchParam('show_past', true, null, true),
'show_future' => $this->fetchParam('show_future', false, null, true),
'type' => 'entries',
'conditions' => trim($this->fetchParam('conditions', null))
));
// prepare if needed
$parse_content = (bool) preg_match(Pattern::USING_CONTENT, $this->content);
if ($parse_content) {
$content_set->prepare();
}
// supplement
$content_set->supplement(array(
'locate_with' => $this->fetchParam('locate_with'),
'center_point' => $this->fetchParam('center_point')
));
// re-filter, we only want entries that have been found
$content_set->filter(array(
'located' => true
));
// sort
$content_set->sort($this->fetchParam('sort_by', 'order_key'), $this->fetchParam('sort_dir'));
// limit
$limit = $this->fetchParam('limit', null, 'is_numeric');
$offset = $this->fetchParam('offset', 0, 'is_numeric');
$paginate = $this->fetchParam('paginate', true, null, true, false);
if ($limit || $offset) {
if ($limit && $paginate && !$offset) {
// pagination requested, isolate the appropriate page
$content_set->isolatePage($limit, URL::getCurrentPaginationPage());
} else {
// just limit
$content_set->limit($limit, $offset);
}
}
// get content
$content_set->prepare(false, true);
$content = $content_set->get($parse_content);
// set variables
$map_id = $this->fetchParam('map_id', Helper::getRandomString());
$zoom = $this->fetchParam('zoom', 12);
// cluster options
$clusters = $this->fetchParam('clusters', TRUE, NULL, TRUE);
$clusters = ($clusters) ? "true" : "false";
$spiderfy_on_max_zoom = $this->fetchParam('spiderfy_on_max_zoom', TRUE, NULL, TRUE);
$spiderfy_on_max_zoom = ($spiderfy_on_max_zoom) ? "true" : "false";
$show_coverage_on_hover = $this->fetchParam('show_coverage_on_hover', TRUE, NULL, TRUE);
//.........这里部分代码省略.........
示例6: listing
public function listing()
{
if (Config::get('disable_member_cache')) {
$this->log->error("Cannot use `member:listing` when `_disable_member_cache` is `true`.");
return Parse::template($this->content, array('no_results' => true));
}
// grab common parameters
$settings = $this->parseCommonParameters();
// grab member set based on the common parameters
$member_set = $this->getMemberSet($settings);
// grab total members for setting later
$total_members = $member_set->count();
// no users found? return no results
if (!$total_members) {
return Parse::template($this->content, array('no_results' => true));
}
// limit
$limit = $this->fetchParam('limit', null, 'is_numeric');
$offset = $this->fetchParam('offset', 0, 'is_numeric');
$paginate = $this->fetchParam('paginate', true, null, true, false);
if ($limit || $offset) {
if ($limit && $paginate && !$offset) {
// pagination requested, isolate the appropriate page
$member_set->isolatePage($limit, URL::getCurrentPaginationPage());
} else {
// just limit or offset
$member_set->limit($limit, $offset);
}
}
// manually supplement
$member_set->supplement(array('total_found' => $total_members));
// check for results
if (!$member_set->count()) {
return Parse::template($this->content, array('no_results' => true));
}
return Parse::tagLoop($this->content, $member_set->get(), true, $this->context);
}