PageRenderTime 46ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/components/com_content/views/category/view.feed.php

https://github.com/joebushi/joomla
PHP | 64 lines | 32 code | 11 blank | 21 comment | 0 complexity | 8d69bc571de99db797820b79110d0e32 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. <?php
  2. /**
  3. * @version $Id$
  4. * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
  5. * @license GNU General Public License version 2 or later; see LICENSE.txt
  6. */
  7. // No direct access
  8. defined('_JEXEC') or die;
  9. jimport('joomla.application.component.view');
  10. /**
  11. * HTML View class for the Content component
  12. *
  13. * @package Joomla.Site
  14. * @subpackage com_content
  15. * @since 1.5
  16. */
  17. class ContentViewCategory extends JView
  18. {
  19. function display()
  20. {
  21. $app = JFactory::getApplication();
  22. $doc = &JFactory::getDocument();
  23. $params = &$app->getParams();
  24. // Get some data from the model
  25. JRequest::setVar('limit', $app->getCfg('feed_limit'));
  26. $category = & $this->get('Category');
  27. $rows = & $this->get('Data');
  28. $doc->link = JRoute::_(ContentHelperRoute::getCategoryRoute($category->id, $cagtegory->sectionid));
  29. foreach ($rows as $row)
  30. {
  31. // strip html from feed item title
  32. $title = $this->escape($row->title);
  33. $title = html_entity_decode($title);
  34. // url link to article
  35. // & used instead of &amp; as this is converted by feed creator
  36. $link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
  37. // strip html from feed item description text
  38. // TODO: Only pull fulltext if necessary (actually, just get the necessary fields).
  39. $description = ($params->get('feed_summary', 0) ? $row->introtext/*.$row->fulltext*/ : $row->introtext);
  40. $author = $row->created_by_alias ? $row->created_by_alias : $row->author;
  41. @$date = ($row->created ? date('r', strtotime($row->created)) : '');
  42. // load individual item creator class
  43. $item = new JFeedItem();
  44. $item->title = $title;
  45. $item->link = $link;
  46. $item->description = $description;
  47. $item->date = $date;
  48. $item->category = $row->category;
  49. // loads item info into rss array
  50. $doc->addItem($item);
  51. }
  52. }
  53. }