Beispiel #1
0
	/**
	 * Adds current active menu item page title, description, keywords, and robots to head
	 *
	 * @return void
	 */
	function setMenuMeta()
	{
		static $cache	=	null;

		if ( $cache === null ) {
			$menu		=	JFactory::getApplication()->getMenu()->getActive();

			if ( $menu && isset( $menu->id ) ) {
				if ( $menu->params->get( 'page_title' ) ) {
					$this->setPageTitle( CBTxt::T( $menu->params->get( 'page_title' ) ) );
				}

				if ( $menu->params->get( 'menu-meta_description' ) ) {
					$this->document->addHeadMetaData( 'description', CBTxt::T( $menu->params->get( 'menu-meta_description' ) ) );
				}

				if ( $menu->params->get( 'menu-meta_keywords' ) ) {
					$this->document->addHeadMetaData( 'keywords', CBTxt::T( $menu->params->get( 'menu-meta_keywords' ) ) );
				}

				if ( $menu->params->get( 'robots' ) ) {
					$this->document->addHeadMetaData( 'robots', $menu->params->get( 'robots' ) );
				}

				$cache	=	true;
			}
		}
	}