Beispiel #1
0
 /**
  * Prepares the document
  *
  * @return  void
  */
 protected function prepareDocument()
 {
     parent::prepareDocument();
     $app = JFactory::getApplication();
     $menus = $app->getMenu();
     $pathway = $app->getPathway();
     $title = null;
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $this->params->def('page_heading', $this->params->get('page_title', $menu->title));
     } else {
         $this->params->def('page_heading', JText::_('COM_WEBLINKS_DEFAULT_PAGE_TITLE'));
     }
     $id = (int) @$menu->query['id'];
     if ($menu && ($menu->query['option'] != 'com_weblinks' || $id != $this->category->id)) {
         $this->params->set('page_subheading', $this->category->title);
         $path = array(array('title' => $this->category->title, 'link' => ''));
         $category = $this->category->getParent();
         while (($menu->query['option'] != 'com_weblinks' || $id != $category->id) && $category->id > 1) {
             $path[] = array('title' => $category->title, 'link' => WeblinksHelperRoute::getCategoryRoute($category->id));
             $category = $category->getParent();
         }
         $path = array_reverse($path);
         foreach ($path as $item) {
             $pathway->addItem($item['title'], $item['link']);
         }
     }
     parent::addFeed();
 }
 /**
  * Prepares the document
  *
  * @return  void
  */
 protected function prepareDocument()
 {
     parent::prepareDocument();
     $menu = $this->menu;
     $id = (int) @$menu->query['id'];
     if ($menu && ($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] == 'newsfeed' || $id != $this->category->id)) {
         $path = array(array('title' => $this->category->title, 'link' => ''));
         $category = $this->category->getParent();
         while (($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] == 'newsfeed' || $id != $category->id) && $category->id > 1) {
             $path[] = array('title' => $category->title, 'link' => NewsfeedsHelperRoute::getCategoryRoute($category->id));
             $category = $category->getParent();
         }
         $path = array_reverse($path);
         foreach ($path as $item) {
             $this->pathway->addItem($item['title'], $item['link']);
         }
     }
 }
 /**
  * Method to prepares the document
  *
  * @return  void
  *
  * @since   3.2
  */
 protected function prepareDocument()
 {
     parent::prepareDocument();
     $title = null;
     $metadata = new JRegistry($this->state->get('category.metadata'));
     // $this->category = JCategories::getInstance('Catalogue')->get($this->state->get('category.id'));
     $menu = $this->menu;
     $cid = (int) @$menu->query['cid'];
     if ($menu && $cid == $this->category->id) {
         // Если привязана к меню то берем TITLE из меню
         $title = $menu->params->get('page_title');
     } else {
         // Если нет то берем TITLE из настрое категории (по умолчанию название категории)
         $title = $metadata->get('metatitle', $this->category->title);
     }
     $app = JFactory::getApplication();
     // Установка <TITLE>
     if (empty($title)) {
         $title = $app->getCfg('sitename');
     } elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
     } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
     }
     $this->document->setTitle($title);
     // Устновка метаданных
     if ($metadesc = $metadata->get('metadesc', '')) {
         $this->document->setDescription($metadesc);
     } elseif (!$metadesc && $menu->params->get('menu-meta_description')) {
         $this->document->setDescription($menu->params->get('menu-meta_description'));
     }
     if ($metakey = $metadata->get('metakey', '')) {
         $this->document->setMetadata('keywords', $metakey);
     } elseif (!$metakey && $menu->params->get('menu-meta_keywords')) {
         $this->document->setMetadata('keywords', $menu->params->get('menu-meta_keywords'));
     }
     if ($robots = $metadata->get('robots', '')) {
         $this->document->setMetadata('robots', $robots);
     }
 }