本文整理汇总了PHP中Channel::fetch_pagination_data方法的典型用法代码示例。如果您正苦于以下问题:PHP Channel::fetch_pagination_data方法的具体用法?PHP Channel::fetch_pagination_data怎么用?PHP Channel::fetch_pagination_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channel
的用法示例。
在下文中一共展示了Channel::fetch_pagination_data方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rank
//.........这里部分代码省略.........
// --------------------------------------------
if (APP_VER >= '2.4.0') {
ee()->load->library('pagination');
$channel->pagination = new Pagination_object('Channel');
// Used by pagination to determine whether we're coming from the cache
$channel->pagination->dynamic_sql = FALSE;
}
// ----------------------------------------
// Pre-process related data
// ----------------------------------------
// TMPL class is coded so that only
// one method in the weblog class and one
// method in the search class are allowed
// to parse related entries tags. This is
// no doubt for performance reasons.
// ----------------------------------------
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();
}
// ----------------------------------------
// Build Weblog Data Query
// ----------------------------------------
$channel->build_sql_query();
// --------------------------------------------
// Transfer Pagination Variables Over to Channel object
// - Has to go after the building of the query as EE 2.4 does its Pagination work in there
// --------------------------------------------
if (APP_VER >= '2.4.0') {
$transfer = array('paginate' => 'paginate', 'total_pages' => 'total_pages', 'current_page' => 'current_page', 'offset' => 'offset', 'page_next' => 'page_next', 'page_previous' => 'page_previous', 'page_links' => 'pagination_links', 'total_rows' => 'total_rows', 'per_page' => 'per_page', 'per_page' => 'p_limit', 'offset' => 'p_page');
foreach ($transfer as $from => $to) {
$channel->{$to} = $channel->pagination->{$from};
}
}
// ----------------------------------------
// Empty?
// ----------------------------------------
if (trim($channel->sql) == '') {
if ($this->check_yes(ee()->TMPL->fetch_param('favorites_count'))) {
return $this->return_data = str_replace(LD . 'favorites_count' . RD, '0', ee()->TMPL->tagdata);
} else {
return $this->no_results();
}
}
// ----------------------------------------
// Pagination
// ----------------------------------------
$query = ee()->db->query(preg_replace("/SELECT(.*?)\\s+FROM\\s+/is", 'SELECT COUNT(*) AS count FROM ', $channel->sql));
$this->total_rows = $query->row('count');
//pagination request but no entries?
if ($query->row('count') == 0 and strpos(ee()->TMPL->tagdata, 'paginate') !== FALSE) {
示例2: prep_occurrences_output
//.........这里部分代码省略.........
if (APP_VER >= '2.4.0') {
ee()->load->library('pagination');
$channel->pagination = new Pagination_object('Channel');
// Used by pagination to determine whether we're coming from the cache
$channel->pagination->dynamic_sql = FALSE;
}
// -------------------------------------
// Prepare parameters
// -------------------------------------
ee()->TMPL->tagparams['entry_id'] = implode('|', $ids);
ee()->TMPL->tagparams['weblog'] = CALENDAR_EVENTS_CHANNEL_NAME;
ee()->TMPL->tagparams['channel'] = CALENDAR_EVENTS_CHANNEL_NAME;
// -------------------------------------
// Pre-process related data
// -------------------------------------
ee()->TMPL->tagdata = ee()->TMPL->assign_relationship_data($tagdata);
ee()->TMPL->var_single = array_merge(ee()->TMPL->var_single, ee()->TMPL->related_markers);
ee()->TMPL->var_single['entry_id'] = 'entry_id';
// -------------------------------------
// 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();
}
// -------------------------------------
// Add occurrence_ prefix to custom fields
// -------------------------------------
foreach ($channel->cfields as $sid => $fields) {
foreach ($fields as $name => $fid) {
$channel->cfields[$sid]['occurrence_' . $name] = $fid;
unset($channel->cfields[$sid][$name]);
}
}
// -------------------------------------
// Querification
// -------------------------------------
$channel->build_sql_query();
if ($channel->sql == '') {
return $this->no_results();
}
$channel->query = ee()->db->query($channel->sql);
if ($channel->query->num_rows() == 0) {
//ee()->TMPL->log_item('Calendar: Channel module says no results, bailing');
return $this->no_results();
}
$channel->query->result = $channel->query->result_array();
// -------------------------------------
// Trim IDs and build events
// -------------------------------------
$new_ids = array();
foreach ($channel->query->result as $k => $row) {
$new_ids[$row['entry_id']] = $row['entry_id'];
}
if (empty($new_ids)) {
return $this->no_results();
示例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
/**
* List of Entires for an Author, Sub-Processing for entries() method
*
* @access private
* @param array
* @return string
*/
private function _entries($params = array())
{
/** ----------------------------------------
/** Execute?
/** ----------------------------------------*/
if ($this->entry_id == '') {
return FALSE;
}
/** ----------------------------------------
/** Invoke Channel/Weblog class
/** ----------------------------------------*/
if (APP_VER < 2.0) {
if (!class_exists('Weblog')) {
require PATH_MOD . 'weblog/mod.weblog' . EXT;
}
$channel = new Weblog();
} else {
if (!class_exists('Channel')) {
require PATH_MOD . 'channel/mod.channel.php';
}
$channel = new Channel();
}
// --------------------------------------------
// Invoke Pagination for EE 2.4 and Above
// --------------------------------------------
if (APP_VER >= '2.4.0') {
ee()->load->library('pagination');
$channel->pagination = new Pagination_object('Channel');
// Used by pagination to determine whether we're coming from the cache
$channel->pagination->dynamic_sql = FALSE;
}
/** ----------------------------------------
/** 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 {
//.........这里部分代码省略.........