本文整理汇总了PHP中Channel::add_pagination_data方法的典型用法代码示例。如果您正苦于以下问题:PHP Channel::add_pagination_data方法的具体用法?PHP Channel::add_pagination_data怎么用?PHP Channel::add_pagination_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channel
的用法示例。
在下文中一共展示了Channel::add_pagination_data方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rank
//.........这里部分代码省略.........
$channel->query = ee()->db->query($channel->sql);
if (APP_VER < 2.0) {
$channel->query->result = $channel->query->result_array();
}
// ----------------------------------------
// Empty?
// ----------------------------------------
if (!isset($channel->query) or $channel->query->num_rows() == 0) {
return $this->no_results();
}
// ----------------------------------------
// typography
// ----------------------------------------
if (APP_VER < 2.0) {
if (!class_exists('Typography')) {
require PATH_CORE . 'core.typography' . EXT;
}
$channel->TYPE = new Typography();
$channel->TYPE->convert_curly = FALSE;
} else {
ee()->load->library('typography');
ee()->typography->initialize();
ee()->typography->convert_curly = FALSE;
}
$channel->fetch_categories();
// ----------------------------------------
// Parse and return entry data
// ----------------------------------------
if (APP_VER < 2.0) {
$channel->parse_weblog_entries();
} else {
$channel->parse_channel_entries();
}
// --------------------------------------------
// Render the Pagination Data
// --------------------------------------------
if (APP_VER >= '2.4.0') {
$channel->return_data = $channel->pagination->render($channel->return_data);
} else {
$channel->add_pagination_data();
}
// --------------------------------------------
// Reverse and Related Entries
// --------------------------------------------
if (count(ee()->TMPL->related_data) > 0 and count($channel->related_entries) > 0) {
$channel->parse_related_entries();
}
if (count(ee()->TMPL->reverse_related_data) > 0 and count($channel->reverse_related_entries) > 0) {
$channel->parse_reverse_related_entries();
}
// ----------------------------------------
// Handle problem with pagination segments
// in the url
// ----------------------------------------
if (preg_match("#(/P\\d+)#", ee()->uri->uri_string, $match)) {
$channel->return_data = str_replace($match['1'], "", $channel->return_data);
} elseif (preg_match("#(P\\d+)#", ee()->uri->uri_string, $match)) {
$channel->return_data = str_replace($match['1'], "", $channel->return_data);
}
// ----------------------------------------
// Pagination Replace
// ----------------------------------------
if ($this->paginate == TRUE) {
$this->paginate_data = str_replace(LD . 'current_page' . RD, $this->current_page, $this->paginate_data);
$this->paginate_data = str_replace(LD . 'total_pages' . RD, $this->total_pages, $this->paginate_data);
$this->paginate_data = str_replace(LD . 'pagination_links' . RD, $this->pagination_links, $this->paginate_data);
if (preg_match("/" . LD . "if previous_page" . RD . "(.+?)" . LD . preg_quote(T_SLASH, '/') . "if" . RD . "/s", $this->paginate_data, $match)) {
if ($this->page_previous == '') {
$this->paginate_data = preg_replace("/" . LD . "if previous_page" . RD . ".+?" . LD . preg_quote(T_SLASH, '/') . "if" . RD . "/s", '', $this->paginate_data);
} else {
$match['1'] = preg_replace("/" . LD . 'path.*?' . RD . "/", $this->page_previous, $match['1']);
$match['1'] = preg_replace("/" . LD . 'auto_path' . RD . "/", $this->page_previous, $match['1']);
$this->paginate_data = str_replace($match['0'], $match['1'], $this->paginate_data);
}
}
if (preg_match("/" . LD . "if next_page" . RD . "(.+?)" . LD . preg_quote(T_SLASH, '/') . "if" . RD . "/s", $this->paginate_data, $match)) {
if ($this->page_next == '') {
$this->paginate_data = preg_replace("/" . LD . "if next_page" . RD . ".+?" . LD . preg_quote(T_SLASH, '/') . "if" . RD . "/s", '', $this->paginate_data);
} else {
$match['1'] = preg_replace("/" . LD . 'path.*?' . RD . "/", $this->page_next, $match['1']);
$match['1'] = preg_replace("/" . LD . 'auto_path' . RD . "/", $this->page_next, $match['1']);
$this->paginate_data = str_replace($match['0'], $match['1'], $this->paginate_data);
}
}
$position = !ee()->TMPL->fetch_param('paginate') ? '' : ee()->TMPL->fetch_param('paginate');
switch ($position) {
case "top":
$channel->return_data = $this->paginate_data . $channel->return_data;
break;
case "both":
$channel->return_data = $this->paginate_data . $channel->return_data . $this->paginate_data;
break;
default:
$channel->return_data .= $this->paginate_data;
break;
}
}
$tagdata = $channel->return_data;
return $tagdata;
}
示例2: form
//.........这里部分代码省略.........
} else {
$super_temp_fake = $channel->query->result_array = $channel->query->result;
$super_temp_fake = $channel->query->row_array();
}
$channel->fetch_categories();
// -------------------------------------
// Prep ignored fields to be ignored
// -------------------------------------
$gibberish = 'e46b98f8a2a06d1ac6069e8980693dc0';
foreach ($ignore_fields as $field) {
ee()->TMPL->tagdata = str_replace(LD . $field, LD . $gibberish . $field, ee()->TMPL->tagdata);
}
// -------------------------------------
// Parse
// -------------------------------------
//ee()->TMPL->log_item('Calendar: Parsing, via channel module');
if (APP_VER < 2.0) {
$channel->parse_weblog_entries();
} else {
$channel->parse_channel_entries();
}
// -------------------------------------
// De-prep ignored fields
// -------------------------------------
foreach ($ignore_fields as $field) {
$channel->return_data = str_replace(LD . $gibberish . $field, LD . $field, $channel->return_data);
}
// -------------------------------------
// Paginate
// -------------------------------------
if (APP_VER >= '2.4.0') {
$channel->return_data = $this->channel->pagination->render($this->channel->return_data);
} else {
$channel->add_pagination_data();
}
// -------------------------------------
// Related entries
// -------------------------------------
if (count(ee()->TMPL->related_data) > 0 and count($channel->related_entries) > 0) {
$channel->parse_related_entries();
}
if (count(ee()->TMPL->reverse_related_data) > 0 and count($channel->reverse_related_entries) > 0) {
$channel->parse_reverse_related_entries();
}
// -------------------------------------
// Grab the goods
// -------------------------------------
ee()->TMPL->tagdata = $channel->return_data;
// -------------------------------------
// Add some hidden variables
// -------------------------------------
$date = ee()->localize->decode_date('%Y-%m-%d %g:%i %A', $super_temp_fake['entry_date']);
$more = "<input type='hidden' name='entry_date' value='{$date}' />\n";
if ($this->P->value('occurrence_date') === FALSE or $this->P->value('event_name') === FALSE or $this->P->value('event_id') === FALSE) {
$more .= "<input type='hidden' name='entry_id' value='{$event_id}' />\n";
}
ee()->TMPL->tagdata .= $more;
} else {
// -------------------------------------
// Add _field_name and _field_format variables
// -------------------------------------
if (APP_VER < 2.0) {
$channel->fetch_custom_weblog_fields();
} else {
$channel->fetch_custom_channel_fields();
}
示例3: search
function search()
{
$address = '';
$tagdata = $this->EE->TMPL->tagdata;
$prec = !$this->EE->TMPL->fetch_param('prec') ? '' : ',' . $this->EE->TMPL->fetch_param('prec');
$prefix = !$this->EE->TMPL->fetch_param('prefix') ? '' : ',' . $this->EE->TMPL->fetch_param('prefix');
$orderby = !$this->EE->TMPL->fetch_param('orderby') ? false : ($this->EE->TMPL->fetch_param('orderby') == 'distance' ? false : $this->EE->TMPL->fetch_param('orderby'));
$sort = !$this->EE->TMPL->fetch_param('sort') ? 'asc' : $this->EE->TMPL->fetch_param('sort');
$this->EE->TMPL->tagparams['limit'] = !$this->EE->TMPL->fetch_param('limit') ? 99999 : $this->EE->TMPL->fetch_param('limit');
$address_fields = !$this->EE->TMPL->fetch_param('address_fields') ? false : $this->EE->TMPL->fetch_param('address_fields');
$debug = !$this->EE->TMPL->fetch_param('debug') ? false : true;
//@delete
$reverse_geocoding = !$this->EE->TMPL->fetch_param('reverse_geocoding') ? '' : ',' . $this->EE->TMPL->fetch_param('reverse_geocoding');
if (isset($_POST) and count($_POST) > 0 or isset($_GET) and count($_GET) > 0) {
$zipLongitude = $this->EE->security->xss_clean($this->EE->input->get_post('long'));
$zipLatitude = $this->EE->security->xss_clean($this->EE->input->get_post('lat'));
$unit = $this->EE->security->xss_clean($this->EE->input->get_post('unit'));
//@add to site description
if ($address_fields) {
foreach (explode('|', $address_fields) as $field_name) {
$address = $this->EE->input->get_post($field_name) ? $address . $this->EE->security->xss_clean($this->EE->input->get_post($field_name)) . ', ' : '';
}
} else {
$address = $this->EE->security->xss_clean($this->EE->input->get_post('address'));
if (is_array($address)) {
$address = implode(",", $address);
}
}
$address = $prefix . $address;
$radius = $this->EE->security->xss_clean($this->EE->input->get_post('radius'));
} else {
$zipLongitude = $this->EE->TMPL->fetch_param('long') != '' ? $this->EE->TMPL->fetch_param('long') : "";
$zipLatitude = $this->EE->TMPL->fetch_param('lat') != '' ? $this->EE->TMPL->fetch_param('lat') : '';
$unit = $this->EE->TMPL->fetch_param('unit') != '' ? $this->EE->TMPL->fetch_param('unit') : 'ml';
$address = $this->EE->TMPL->fetch_param('address') != '' ? $this->EE->TMPL->fetch_param('address') : '';
$radius = $this->EE->TMPL->fetch_param('radius') != '' ? $this->EE->TMPL->fetch_param('radius') : $this->default_radius;
}
$radius = $radius == '' ? $this->default_radius : $radius;
$earth_radius = $unit == 'km' ? 6371 : 3959;
//earth_radius
if (($zipLongitude == "" or $zipLatitude == "") and $address == "") {
$zipLongitude = $this->default_long;
$zipLatitude = $this->default_lat;
$address = $this->default_address;
}
$entry_id = '';
$points = array();
$entry_id = rtrim($entry_id, '|');
$channel = new Channel();
$LD = '\\{';
$RD = '\\}';
$SLASH = '\\/';
$variable = "entries";
$return_data = "";
if (isset($_POST['categories'])) {
$this->EE->TMPL->tagparams['category'] = (isset($this->EE->TMPL->tagparams['category']) ? $this->EE->TMPL->tagparams['category'] : '') . '|' . implode("|", $this->EE->security->xss_clean($_POST['categories']));
}
if (preg_match("/" . LD . $variable . ".*?" . RD . "(.*?)" . LD . '\\/' . $variable . RD . "/s", $tagdata, $entries)) {
$channel->EE->TMPL->tagdata = $entries[1];
if ($channel->EE->TMPL->fetch_param('related_categories_mode') == 'yes') {
return $channel->related_entries();
}
$channel->initialize();
$channel->uri = $channel->query_string != '' ? $channel->query_string : 'index.php';
if ($channel->enable['custom_fields'] == TRUE) {
$channel->fetch_custom_channel_fields();
}
if ($channel->enable['member_data'] == TRUE) {
$channel->fetch_custom_member_fields();
}
if ($channel->enable['pagination'] == TRUE) {
if (version_compare(APP_VER, '2.4', '>=')) {
$channel->add_pagination_data();
} else {
$channel->fetch_pagination_data();
}
}
$save_cache = FALSE;
$channel->EE->TMPL->tagparams['dynamic'] = 'no';
//$zipLongitude.$zipLatitude.$address
if ($channel->EE->config->item('enable_sql_caching') == 'y') {
if (FALSE == ($channel->sql = $channel->fetch_cache())) {
$save_cache = TRUE;
} else {
if ($channel->EE->TMPL->fetch_param('dynamic') != 'no') {
if (preg_match("#(^|\\/)C(\\d+)#", $channel->query_string, $match) or in_array($channel->reserved_cat_segment, explode("/", $channel->query_string))) {
$channel->cat_request = TRUE;
}
}
}
if (FALSE !== ($cache = $channel->fetch_cache('pagination_count'))) {
if (FALSE !== $channel->fetch_cache('field_pagination')) {
if (FALSE !== ($pg_query = $channel->fetch_cache('pagination_query'))) {
$channel->paginate = TRUE;
$channel->field_pagination = TRUE;
$channel->create_pagination(trim($cache), $channel->EE->db->query(trim($pg_query)));
}
} else {
$channel->create_pagination(trim($cache));
}
//.........这里部分代码省略.........
示例4: _entries
//.........这里部分代码省略.........
/** ----------------------------------------
/** Pass params
/** ----------------------------------------*/
ee()->TMPL->tagparams['entry_id'] = $this->entry_id;
ee()->TMPL->tagparams['inclusive'] = '';
if (isset($params['dynamic']) and $params['dynamic'] == "off") {
if (APP_VER < 2.0) {
ee()->TMPL->tagparams['dynamic'] = 'off';
} else {
ee()->TMPL->tagparams['dynamic'] = 'no';
}
}
/** ----------------------------------------
/** Pre-process related data
/** ----------------------------------------*/
ee()->TMPL->tagdata = ee()->TMPL->assign_relationship_data(ee()->TMPL->tagdata);
ee()->TMPL->var_single = array_merge(ee()->TMPL->var_single, ee()->TMPL->related_markers);
/** ----------------------------------------
/** Execute needed methods
/** ----------------------------------------*/
if (APP_VER < 2.0) {
$channel->fetch_custom_weblog_fields();
} else {
$channel->fetch_custom_channel_fields();
}
$channel->fetch_custom_member_fields();
// --------------------------------------------
// Pagination Tags Parsed Out
// --------------------------------------------
if (APP_VER >= '2.4.0') {
$channel->pagination->get_template();
} else {
$channel->fetch_pagination_data();
}
if (APP_VER >= '2.4.0') {
$channel->pagination->cfields = $channel->cfields;
$channel->pagination->build();
} else {
$channel->create_pagination();
}
/** ----------------------------------------
/** Grab entry data
/** ----------------------------------------*/
//$channel->create_pagination();
$channel->build_sql_query();
if ($channel->sql == '') {
return $this->no_results();
}
$channel->query = ee()->db->query($channel->sql);
if (APP_VER < 2.0) {
$channel->query->result = $channel->query->result_array();
}
if (!isset($channel->query) or $channel->query->num_rows() == 0) {
return $this->no_results();
}
if (APP_VER < 2.0) {
if (!class_exists('Typography')) {
require PATH_CORE . 'core.typography' . EXT;
}
$channel->TYPE = new Typography();
$channel->TYPE->convert_curly = FALSE;
} else {
ee()->load->library('typography');
ee()->typography->initialize();
ee()->typography->convert_curly = FALSE;
}
$channel->fetch_categories();
/** ----------------------------------------
/** Parse and return entry data
/** ----------------------------------------*/
if (APP_VER < 2.0) {
$channel->parse_weblog_entries();
} else {
$channel->parse_channel_entries();
}
if (APP_VER >= '2.4.0') {
$channel->return_data = $channel->pagination->render($channel->return_data);
} else {
$channel->add_pagination_data();
}
/** ----------------------------------------
/** Count tag
/** ----------------------------------------*/
if (count(ee()->TMPL->related_data) > 0 and count($channel->related_entries) > 0) {
$channel->parse_related_entries();
}
if (count(ee()->TMPL->reverse_related_data) > 0 and count($channel->reverse_related_entries) > 0) {
$channel->parse_reverse_related_entries();
}
// ----------------------------------------
// Handle problem with pagination segments in the url
// ----------------------------------------
if (preg_match("#(/P\\d+)#", ee()->uri->uri_string, $match)) {
$channel->return_data = str_replace($match['1'], "", $channel->return_data);
} elseif (preg_match("#(P\\d+)#", ee()->uri->uri_string, $match)) {
$channel->return_data = str_replace($match['1'], "", $channel->return_data);
}
$tagdata = $channel->return_data;
return $tagdata;
}