/components/com_content/views/frontpage/view.feed.php
PHP | 69 lines | 41 code | 7 blank | 21 comment | 3 complexity | 0bccfbec40e6dc3d897bdd9ccb0bb411 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
- <?php
- /**
- * @version $Id$
- * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
- * @license GNU General Public License version 2 or later; see LICENSE.txt
- */
- // No direct access
- defined('_JEXEC') or die;
- jimport('joomla.application.component.view');
- /**
- * Frontpage View class
- *
- * @package Joomla.Site
- * @subpackage com_content
- * @since 1.5
- */
- class ContentViewFrontpage extends JView
- {
- function display($tpl = null)
- {
- // parameters
- $app = &JFactory::getApplication();
- $db = &JFactory::getDbo();
- $document = &JFactory::getDocument();
- $params = &$app->getParams();
- $feedEmail = (@$app->getCfg('feed_email')) ? $app->getCfg('feed_email') : 'author';
- $siteEmail = $app->getCfg('mailfrom');
- $document->link = JRoute::_('index.php?option=com_content&view=frontpage');
- // Get some data from the model
- JRequest::setVar('limit', $app->getCfg('feed_limit'));
- $rows = & $this->get('Data');
- foreach ($rows as $row)
- {
- // strip html from feed item title
- $title = $this->escape($row->title);
- $title = html_entity_decode($title);
- // url link to article
- $link = JRoute::_(ContentRoute::article($row->slug, $row->catslug, $row->sectionid));
- // strip html from feed item description text
- // TODO: Only pull fulltext if necessary (actually, just get the necessary fields).
- $description = ($params->get('feed_summary', 0) ? $row->introtext/*.$row->fulltext*/ : $row->introtext);
- $author = $row->created_by_alias ? $row->created_by_alias : $row->author;
- // load individual item creator class
- $item = new JFeedItem();
- $item->title = $title;
- $item->link = $link;
- $item->description = $description;
- $item->date = $row->created;
- $item->category = 'frontpage';
- $item->author = $author;
- if ($feedEmail == 'site') {
- $item->authorEmail = $siteEmail;
- }
- else {
- $item->authorEmail = $row->author_email;
- }
- // loads item info into rss array
- $document->addItem($item);
- }
- }
- }
- ?>