当前位置: 首页>>代码示例>>PHP>>正文


PHP Channel::parse_related_entries方法代码示例

本文整理汇总了PHP中Channel::parse_related_entries方法的典型用法代码示例。如果您正苦于以下问题:PHP Channel::parse_related_entries方法的具体用法?PHP Channel::parse_related_entries怎么用?PHP Channel::parse_related_entries使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Channel的用法示例。


在下文中一共展示了Channel::parse_related_entries方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
    }
开发者ID:thomasvandoren,项目名称:teentix-site,代码行数:101,代码来源:mod.favorites.php

示例2: strpos


//.........这里部分代码省略.........
         }
     }
     $query = $this->EE->db->query($sql);
     $output = '';
     if (!class_exists('Channel')) {
         require PATH_MOD . 'channel/mod.channel.php';
     }
     unset($this->EE->TMPL->var_single['auto_path']);
     unset($this->EE->TMPL->var_single['excerpt']);
     unset($this->EE->TMPL->var_single['id_auto_path']);
     unset($this->EE->TMPL->var_single['full_text']);
     unset($this->EE->TMPL->var_single['switch']);
     foreach ($this->EE->TMPL->var_single as $key => $value) {
         if (substr($key, 0, strlen('member_path')) == 'member_path') {
             unset($this->EE->TMPL->var_single[$key]);
         }
     }
     $channel = new Channel();
     // This allows the channel {absolute_count} variable to work
     $channel->pagination->offset = $pagination->per_page * $pagination->current_page - $pagination->per_page;
     $channel->fetch_custom_channel_fields();
     $channel->fetch_custom_member_fields();
     $channel->query = $this->EE->db->query($sql);
     if ($channel->query->num_rows() == 0) {
         return $this->EE->TMPL->no_results();
     }
     $this->EE->load->library('typography');
     $this->EE->typography->initialize(array('convert_curly' => FALSE, 'encode_email' => FALSE));
     $channel->fetch_categories();
     $channel->parse_channel_entries();
     $tagdata = $this->EE->TMPL->tagdata;
     // Does the tag contain "related entries" that we need to parse out?
     if (count($this->EE->TMPL->related_data) > 0 and count($channel->related_entries) > 0) {
         $channel->parse_related_entries();
     }
     if (count($this->EE->TMPL->reverse_related_data) > 0 and count($channel->reverse_related_entries) > 0) {
         $channel->parse_reverse_related_entries();
     }
     $output = $channel->return_data;
     $this->EE->TMPL->tagdata = $tagdata;
     // Fetch member path variable
     // We do it here in case it's used in multiple places.
     $m_paths = array();
     if (preg_match_all("/" . LD . "member_path(\\s*=.*?)" . RD . "/s", $this->EE->TMPL->tagdata, $matches)) {
         for ($j = 0; $j < count($matches['0']); $j++) {
             $m_paths[] = array($matches['0'][$j], $this->EE->functions->extract_path($matches['1'][$j]));
         }
     }
     // Fetch switch param
     $switch1 = '';
     $switch2 = '';
     if ($switch = $this->EE->TMPL->fetch_param('switch')) {
         if (strpos($switch, '|') !== FALSE) {
             $x = explode("|", $switch);
             $switch1 = $x['0'];
             $switch2 = $x['1'];
         } else {
             $switch1 = $switch;
         }
     }
     /** -----------------------------
     		/**  Result Loop - Legacy!
     		/** -----------------------------*/
     $i = 0;
     foreach ($query->result_array() as $row) {
         if (isset($row['field_id_' . $row['search_excerpt']]) and $row['field_id_' . $row['search_excerpt']]) {
开发者ID:thomasvandoren,项目名称:teentix-site,代码行数:67,代码来源:mod.search.php

示例3: search


//.........这里部分代码省略.........
                     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));
                 }
             }
         }
         if ($channel->sql == '') {
             $channel->build_sql_query();
         }
         if ($channel->sql == '') {
             return $channel->EE->TMPL->no_results();
         }
         $sql = "";
         //@start geocoding
         //if don't have the Latitude and Longitude, do query to google.map; ($zipLongitude == "" OR $zipLatitude == "") AND
         if ($address != "" and ($zipLongitude == "" or $zipLatitude == "")) {
             $GetLatLong_result = $this->GetLatLong($address, 2);
             if ($GetLatLong_result != false) {
                 list($zipLongitude, $zipLatitude) = $GetLatLong_result;
             } else {
                 return $this->EE->TMPL->no_results();
             }
         }
         if ($reverse_geocoding and $address == "") {
             $GetLatLong_result = $this->GetLatLong($zipLatitude . ',' . $zipLongitude, $api_key, 1);
             if ($GetLatLong_result != false) {
                 $address = $GetLatLong_result;
             } else {
                 return $this->EE->TMPL->no_results();
             }
         }
         //@END geocoding
         $conds['radius'] = $radius;
         $tagdata = $this->EE->functions->prep_conditionals($tagdata, $conds);
         $tagdata = str_replace(array('{center:long}', '{center:lat}', '{radius}'), array($zipLongitude, $zipLatitude, $radius), $tagdata);
         $where_strpos = strpos($channel->sql, "WHERE");
         if ($where_strpos > 0) {
             $sql_entry_id = substr($channel->sql, $where_strpos + 5, strpos($channel->sql, "ORDER BY") - $where_strpos - 5);
             $limit_strpos = strpos($channel->sql, "LIMIT");
             $order_by = substr($channel->sql, strpos($channel->sql, "ORDER BY"), $limit_strpos);
             $limit = substr($channel->sql, strpos($channel->sql, "LIMIT"));
             $sql = str_replace('FROM', ", gm.*, ROUND( {$earth_radius} * acos( cos( radians({$zipLatitude}) ) * cos( radians( gm.latitude ) ) * cos( radians( gm.longitude ) - radians({$zipLongitude}) ) + sin( radians({$zipLatitude}) ) *  sin( radians( gm.latitude ) ) ) {$prec} ) AS distance   FROM ", $channel->sql);
             $sql = substr($sql, 0, strpos($sql, "WHERE")) . "RIGHT JOIN exp_mx_google_map AS gm ON t.entry_id = gm.entry_id HAVING distance < {$radius} AND " . $sql_entry_id;
             if ($orderby) {
                 $sql = $sql . $order_by;
             } else {
                 $sql = $sql . " ORDER BY distance " . $sort;
             }
             $channel->sql = $sql;
         }
         if ($save_cache == TRUE) {
             $channel->save_cache($channel->sql);
         }
         $channel->query = $channel->EE->db->query($channel->sql);
         if ($channel->query->num_rows() == 0) {
             return $channel->EE->TMPL->no_results();
         }
         foreach ($channel->query->result_array() as $row) {
             $points[$row['point_id']] = $row['distance'];
         }
         $channel->EE->TMPL->tagparams['points'] = $points;
         if ($channel->EE->config->item('relaxed_track_views') === 'y' && $channel->query->num_rows() == 1) {
             $channel->hit_tracking_id = $channel->query->row('entry_id');
         }
         $channel->track_views();
         $channel->EE->load->library('typography');
         $channel->EE->typography->initialize();
         $channel->EE->typography->convert_curly = FALSE;
         if ($channel->enable['categories'] == TRUE) {
             $channel->fetch_categories();
         }
         $channel->parse_channel_entries();
         if ($channel->enable['pagination'] == TRUE) {
             if (version_compare(APP_VER, '2.4', '>=')) {
                 $channel->add_pagination_data();
             } else {
                 $channel->fetch_pagination_data();
             }
         }
         if (count($channel->EE->TMPL->related_data) > 0 && count($channel->related_entries) > 0) {
             $channel->parse_related_entries();
         }
         if (count($channel->EE->TMPL->reverse_related_data) > 0 && count($channel->reverse_related_entries) > 0) {
             $channel->parse_reverse_related_entries();
         }
         $return_data = str_replace($entries[0], $channel->return_data, $tagdata);
     }
     return $return_data;
 }
开发者ID:thomasvandoren,项目名称:teentix-site,代码行数:101,代码来源:mod.mx_google_map.php

示例4: prep_occurrences_output


//.........这里部分代码省略.........
         }
         // --------------------------------------------
         //  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
         // -------------------------------------
         //ee()->TMPL->log_item('Calendar: Parsing, via channel module');
         if (APP_VER < 2.0) {
             $channel->parse_weblog_entries();
         } else {
             $channel->parse_channel_entries();
         }
         // -------------------------------------
         //  Paginate
         // -------------------------------------
         //$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();
         }
         // -------------------------------------
         //  Send 'em home
         // -------------------------------------
         $tagdata = $channel->return_data;
         // -------------------------------------
         //  Collect the tagdata
         // -------------------------------------
         preg_match_all("/" . LD . 'occurrences id="(\\d+)"' . RD . '(.*?)' . LD . preg_quote(T_SLASH, '/') . 'occurrences' . RD . '/s', $tagdata, $matches);
         foreach ($matches[1] as $k => $id) {
             $tagdatas[$id] = $matches[2][$k];
         }
         //ee()->TMPL = ee()->TMPL_orig;
     }
     // -------------------------------------
     //  Date and time variables
     // -------------------------------------
     $dt_vars = array('start_date', 'end_date', 'start_time', 'end_time');
     $count = 1;
     $total = 0;
     foreach ($data->dates as $date) {
         $total += count($date);
     }
     if (empty($data->dates)) {
         return $this->no_results();
     }
     //--------------------------------------------
     //	reverse sorting
     //--------------------------------------------
开发者ID:thomasvandoren,项目名称:teentix-site,代码行数:67,代码来源:mod.calendar.php

示例5: _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;
 }
开发者ID:TAGraves,项目名称:Compendium-Prototype,代码行数:101,代码来源:mod.user.backup.php

示例6: array


//.........这里部分代码省略.........
			if (substr($key, 0, strlen('member_path')) == 'member_path')
			{
				unset($this->EE->TMPL->var_single[$key]);
			}
		}

		$channel = new Channel;		

		// This allows the channel {absolute_count} variable to work
		$channel->p_page = ($per_page * $current_page) - $per_page;

		$channel->fetch_custom_channel_fields();
		$channel->fetch_custom_member_fields();
		$channel->query = $this->EE->db->query($sql);
		
		if ($channel->query->num_rows() == 0)
		{
			return $this->EE->TMPL->no_results();
		}
		
		$this->EE->load->library('typography');
		$this->EE->typography->initialize();
		$this->EE->typography->convert_curly = FALSE;
		$this->EE->typography->encode_email = FALSE;
		
		$channel->fetch_categories();
		$channel->parse_channel_entries();
		
		$tagdata = $this->EE->TMPL->tagdata;

		// Does the tag contain "related entries" that we need to parse out?
		if (count($this->EE->TMPL->related_data) > 0 AND count($channel->related_entries) > 0)
		{
			$channel->parse_related_entries();
		}
		
		if (count($this->EE->TMPL->reverse_related_data) > 0 AND count($channel->reverse_related_entries) > 0)
		{
			$channel->parse_reverse_related_entries();
		}
				
		$output = $channel->return_data;
		
		$this->EE->TMPL->tagdata = $tagdata;
		
		// Fetch member path variable
		// We do it here in case it's used in multiple places.		
		$m_paths = array();
		
		if (preg_match_all("/".LD."member_path(\s*=.*?)".RD."/s", $this->EE->TMPL->tagdata, $matches))
		{ 
			for ($j = 0; $j < count($matches['0']); $j++)
			{			
				$m_paths[] = array($matches['0'][$j], $this->EE->functions->extract_path($matches['1'][$j]));
			}
		}
		
		// Fetch switch param
		$switch1 = '';
		$switch2 = '';
		
		if ($switch = $this->EE->TMPL->fetch_param('switch'))
		{
			if (strpos($switch, '|') !== FALSE)
			{
				$x = explode("|", $switch);
开发者ID:rmdort,项目名称:adiee,代码行数:67,代码来源:mod.search.php


注:本文中的Channel::parse_related_entries方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。