[ Index ]

PHP Cross Reference of Joomla 2.5.4 DE

title

Body

[close]

/components/com_content/views/featured/ -> view.feed.php (source)

   1  <?php
   2  /**
   3   * @copyright    Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
   4   * @license        GNU General Public License version 2 or later; see LICENSE.txt
   5   */
   6  
   7  // No direct access
   8  defined('_JEXEC') or die;
   9  
  10  jimport('joomla.application.component.view');
  11  
  12  /**
  13   * Frontpage View class
  14   *
  15   * @package        Joomla.Site
  16   * @subpackage    com_content
  17   * @since        1.5
  18   */
  19  class ContentViewFeatured extends JView
  20  {
  21  	function display($tpl = null)
  22      {
  23          // parameters
  24          $app        = JFactory::getApplication();
  25          $db            = JFactory::getDbo();
  26          $document    = JFactory::getDocument();
  27          $params        = $app->getParams();
  28          $feedEmail    = (@$app->getCfg('feed_email')) ? $app->getCfg('feed_email') : 'author';
  29          $siteEmail    = $app->getCfg('mailfrom');
  30          $document->link = JRoute::_('index.php?option=com_content&view=featured');
  31  
  32          // Get some data from the model
  33          JRequest::setVar('limit', $app->getCfg('feed_limit'));
  34          $categories = JCategories::getInstance('Content');
  35          $rows        = $this->get('Items');
  36          foreach ($rows as $row)
  37          {
  38              // strip html from feed item title
  39              $title = $this->escape($row->title);
  40              $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
  41  
  42              // Compute the article slug
  43              $row->slug = $row->alias ? ($row->id . ':' . $row->alias) : $row->id;
  44  
  45              // url link to article
  46              $link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catid));
  47  
  48  
  49              // strip html from feed item description text
  50              // TODO: Only pull fulltext if necessary (actually, just get the necessary fields).
  51              $description    = ($params->get('feed_summary', 0) ? $row->introtext/*.$row->fulltext*/ : $row->introtext);
  52              $author            = $row->created_by_alias ? $row->created_by_alias : $row->author;
  53  
  54              // load individual item creator class
  55              $item = new JFeedItem();
  56              $item->title        = $title;
  57              $item->link            = $link;
  58              $item->description    = $description;
  59              $item->date            = $row->created;
  60  
  61              $item_category        = $categories->get($row->catid);
  62              $item->category        = array();
  63              $item->category[]    = JText::_('JFEATURED'); // All featured articles are categorized as "Featured"
  64              for ($item_category = $categories->get($row->catid); $item_category !== null; $item_category = $item_category->getParent()) {
  65                  if ($item_category->id > 1) { // Only add non-root categories
  66                      $item->category[] = $item_category->title;
  67                  }
  68              }
  69  
  70              $item->author        = $author;
  71              if ($feedEmail == 'site') {
  72                  $item->authorEmail = $siteEmail;
  73              }
  74              else {
  75                  $item->authorEmail = $row->author_email;
  76              }
  77              // loads item info into rss array
  78              $document->addItem($item);
  79          }
  80      }
  81  }
  82  ?>


Generated: Tue Apr 3 11:40:28 2012 Cross-referenced by PHPXref 0.7.1