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


PHP FlexicontentHelperRoute::_setDefaultMenuitemId方法代码示例

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


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

示例1: getTagRoute

	/**
	 * Get routed links for tags
	 */
	static function getTagRoute($id, $Itemid = 0)
	{
		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();
			}
		}
		
		// Get default menu item for 'tags' view
		static $_tags_default_menuitem_id = null;
		if ($_tags_default_menuitem_id === null)
		{
			$params = JComponentHelper::getParams('com_flexicontent');
			$_tags_default_menuitem_id = $params->get('tags_view_default_menu_itemid', false);
		}
		
		
		// *********************
		// Get data of given TAG
		// data like: language
		// *********************
		
		// Get language, IN FUTURE tags will have language because we will use J3+ tags
		$language = '*';
		
		
		// **********************************************************
		// Create the needles for table lookup in descending priority
		// **********************************************************
		$needles = array();
		
		$needles['tags'] = array( (int) $id );
		
		
		// ***************
		// Create the link
		// ***************
		
		$link = 'index.php?option=com_flexicontent&view=tags&id='.$id;
		
		// Other data to pass to _findTag()
		$data = array();
		
		// use SEF language code as so configured
		$data['language'] = '*';  // Default to ALL
		if ($use_language && $language && $language != "*")
		{
			if(isset(self::$lang_lookup[$language]))
			{
				if ( self::$add_url_lang && isset(self::$interface_langs[$language]) ) {
					$link .= '&lang='.self::$lang_lookup[$language];
				}
				$data['language'] = $language;
			}
		}
		
		
		// USE the itemid provided, if we were given one it means it is "appropriate and relevant"
		if ($Itemid) {
			$link .= '&Itemid='.$Itemid;
		}
		
		// Try to find the most appropriate/relevant menu item, using the priority set via needles array
		else if ($menuitem = FlexicontentHelperRoute::_findTag($needles, $data)) {
			$link .= '&Itemid='.$menuitem->id;
		}
		
		// Fallback to default menu item for the view
		else if ($_tags_default_menuitem_id) {
			$link .= '&Itemid='.$_tags_default_menuitem_id;
		}
		
		// Try to use component's default menu item, this is according to COMPONENT CONFIGURATION and includes ACTIVE menu item if appropriate
		else {
			if ($component_default_menuitem_id === null)
				$component_default_menuitem_id = FlexicontentHelperRoute::_setDefaultMenuitemId();
			if ($component_default_menuitem_id)
				$link .= '&Itemid='.$component_default_menuitem_id;
		}
		
		return $link;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:95,代码来源:route.php

示例2: getTagRoute

 /**
  * Get routed links for tags
  */
 static function getTagRoute($id, $_Itemid = 0)
 {
     $Itemid = $_Itemid == -1 ? 0 : $_Itemid;
     // -1 indicates to return the found menu Itemid instead of the produced link
     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 = JLanguageMultilang::isEnabled();
         if ($use_language) {
             self::_buildLanguageLookup();
         }
     }
     // Get default menu item for 'tags' view
     static $_tags_default_menuitem_id = null;
     if ($_tags_default_menuitem_id === null) {
         $params = JComponentHelper::getParams('com_flexicontent');
         $_tags_default_menuitem_id = $params->get('tags_view_default_menu_itemid', false);
     }
     // *********************
     // Get data of given TAG
     // data like: language
     // *********************
     // Get language, IN FUTURE tags will have language because we will use J3+ tags
     $language = '*';
     // **********************************************************
     // Create the needles for table lookup in descending priority
     // **********************************************************
     $needles = array();
     $needles['tags'] = array((int) $id);
     // ***************
     // Create the link
     // ***************
     $link = 'index.php?option=com_flexicontent&view=tags&id=' . $id;
     // Other data to pass to _findTag()
     $data = array();
     // use SEF language code as so configured
     $data['language'] = '*';
     // Default to ALL
     if ($use_language && $language && $language != "*") {
         if (isset(self::$lang_lookup[$language])) {
             if (self::$add_url_lang && isset(self::$interface_langs[$language])) {
                 $link .= '&lang=' . self::$lang_lookup[$language];
             }
             $data['language'] = $language;
         }
     }
     // USE the itemid provided, if we were given one it means it is "appropriate and relevant"
     if ($Itemid) {
         $link .= '&Itemid=' . $Itemid;
     } else {
         if ($menuitem = FlexicontentHelperRoute::_findTag($needles, $data)) {
             $Itemid = $menuitem->id;
             $link .= '&Itemid=' . $Itemid;
         } else {
             if ($_tags_default_menuitem_id) {
                 $Itemid = $_tags_default_menuitem_id;
                 $link .= '&Itemid=' . $Itemid;
             } else {
                 if ($component_default_menuitem_id === null) {
                     $component_default_menuitem_id = FlexicontentHelperRoute::_setDefaultMenuitemId();
                 }
                 $Itemid = (int) $component_default_menuitem_id;
                 // if false (aka not set) then it will be typecasted to ZERO
                 if ($Itemid) {
                     $link .= '&Itemid=' . $Itemid;
                 }
             }
         }
     }
     // Return menu Itemid or the produced link
     return $_Itemid == -1 ? $Itemid : $link;
 }
开发者ID:khetsothea,项目名称:flexicontent-cck,代码行数:81,代码来源:route.php


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