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


PHP FlexicontentHelperRoute::_getTypeParams方法代码示例

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


在下文中一共展示了FlexicontentHelperRoute::_getTypeParams方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getItemRoute

	/**
	 * Get routed links for content items
	 */
	static function getItemRoute($id, $catid = 0, $Itemid = 0, $item = null)
	{
		static $component_default_menuitem_id = null;  // Calculate later only if needed
		
		static $current_language = null;
		if ($current_language === null) {
			$current_language = JFactory::getLanguage()->getTag();  // Current language tag for J2.5+ but not for J1.5
		}
		
		static $use_language = null;
		if ($use_language === null)
		{
			$use_language = FLEXI_J16GE && JLanguageMultilang::isEnabled();
			if ($use_language) {
				self::_buildLanguageLookup();
			}
		}
		
		global $globalcats;
		$_catid = (int) $catid;
		$_id = (int) $id;
		
		
		// *****************************************************************
		// Get data of the FLEXIcontent item (only if not already given)
		// including data like: type id, language, but do not do 1 SQL query
		// per item, to get the type id and language  ...  
		// for language we will use current language, for type_id, we ignore
		// *****************************************************************
		
		// Compatibility with calls not passing item data, check for item data in global object, avoiding an extra SQL call
		if ( !$item ) {
			global $fc_list_items;
			if ( !empty($fc_list_items) && isset($fc_list_items[$_id]) ) {
				$item = $fc_list_items[$_id];
			}
		}
		
		// Get language
		$language = (!FLEXI_J16GE || !$item || @!$item->language) ? $current_language : $item->language;
		
		// Get type ID
		$type_id = ($item && isset($item->type_id))? $item->type_id : 0;
		
		// Get type data
		static $types = null;
		if ($type_id && $types === null) {
			$types = FlexicontentHelperRoute::_getTypeParams();
		}
		$type = $type_id && isset($types[$type_id])  ?  $types[$type_id] :  false;
		
		
		// *****************************************************************
		// DONE ONCE (per encountered type): Get content type's default menu
		// *****************************************************************
		
		if ( $type ) {
			$type_menu_itemid_usage = $type->params->get('type_menu_itemid_usage', 0);  // ZERO: do not use, 1: before item's category, 2: after item's category
			$type_menu_itemid       = $type->params->get('type_menu_itemid', 0);
			if ($type_menu_itemid_usage && $type_menu_itemid) {
				if ( !isset($type->typeMenuItem) ) {
					$menus = JFactory::getApplication()->getMenu('site', array());   // this will work in J1.5 backend too !!!
					$type->typeMenuItem = $menus->getItem( $type_menu_itemid );
				}
			}
		}
		
		
		// **********************************************************************************
		// Get item's parent categores to be used in search a menu item of type category view
		// **********************************************************************************
		
		$parents_ids = array();
		if ( $_catid && isset($globalcats[$_catid]->ancestorsarray) ) {
			$parents_ids = array_reverse($globalcats[$_catid]->ancestorsarray);
		}
		
		
		// **********************************************************
		// Create the needles for table lookup in descending priority
		// **********************************************************
		
		$needles = array();
		
		// Priority 1: Item view menu items of given item ID
		$needles[FLEXI_ITEMVIEW] = array($_id);
		
		// Priority 2: Type's default before categories (if so configured): ... giving an object means no-lookup and just use it
		if ($type && $type_menu_itemid_usage==1 && $type->typeMenuItem)  $needles['type_before'] = $type->typeMenuItem;
		
		// Priority 3: Category view menu items of given category IDs ... item's category and its parent categories in ascending order
		$needles['category'] = $parents_ids;
		
		// Priority 4: Directory view menu items ... pointing to same category IDs as above
		$needles['flexicontent'] = $needles['category'];
		
		// Priority 5: Type's default after categories (if so configured): ... giving an object means no-lookup and just use it
//.........这里部分代码省略.........
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:101,代码来源:route.php


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