當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。