Skip to content

Instantly share code, notes, and snippets.

@phproberto
Last active November 27, 2017 21:20
Show Gist options
  • Save phproberto/e65a15756e8acfe408ddfcf1e8c16506 to your computer and use it in GitHub Desktop.
Save phproberto/e65a15756e8acfe408ddfcf1e8c16506 to your computer and use it in GitHub Desktop.
Experimento de cambio del formato de RSS para Ciro
<?php
/**
* The update check and notification email code is triggered after the page has fully rendered.
*
* @return void
*/
public function onAfterRender()
{
$app = JFactory::getApplication();
if ($app->input->get('format' !== 'feed'))
{
return;
}
$element = new SimpleXMLElement($app->getBody());
foreach ($element->channel->item as $entry)
{
$entry->title = 'Test: ' . $entry->title;
$image = $entry->addChild('img');
$image->addAttribute('src', JUri::root() . 'images/joomla_black.png');
}
$app->setBody($element->asXML());
}
?>
<?xml version="1.0" encoding="utf-8"?>
<!-- generator="Joomla! - Open Source Content Management" -->
<?xml-stylesheet href="/joomla-cms/media/cms/css/debug.css" type="text/css"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title>Article Category Blog</title>
<description><![CDATA[]]></description>
<link>http://localhost/joomla-cms/index.php/park-blog</link>
<lastBuildDate>Mon, 27 Nov 2017 21:16:26 +0000</lastBuildDate>
<generator>Joomla! - Open Source Content Management</generator>
<atom:link rel="self" type="application/rss+xml" href="http://localhost/joomla-cms/index.php/article-category-blog?format=feed&amp;type=rss"/>
<language>en-gb</language>
<item>
<title>Test: First Blog Post</title>
<link>http://localhost/joomla-cms/index.php/park-blog/17-first-blog-post</link>
<guid isPermaLink="true">http://localhost/joomla-cms/index.php/park-blog/17-first-blog-post</guid>
<description><![CDATA[<p><em>Lorem Ipsum is filler text that is commonly used by designers before the content for a new site is ready.</em></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed faucibus purus vitae diam posuere nec eleifend elit dictum. Aenean sit amet erat purus, id fermentum lorem. Integer elementum tristique lectus, non posuere quam pretium sed. Quisque scelerisque erat at urna condimentum euismod. Fusce vestibulum facilisis est, a accumsan massa aliquam in. In auctor interdum mauris a luctus. Morbi euismod tempor dapibus. Duis dapibus posuere quam. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. In eu est nec erat sollicitudin hendrerit. Pellentesque sed turpis nunc, sit amet laoreet velit. Praesent vulputate semper nulla nec varius. Aenean aliquam, justo at blandit sodales, mauris leo viverra orci, sed sodales mauris orci vitae magna.</p>]]></description>
<category>Park Blog</category>
<pubDate>Fri, 31 Dec 2010 23:00:01 +0000</pubDate>
<img src="http://localhost/joomla-cms/images/joomla_black.png"/></item>
<item>
<title>Test: Second Blog Post</title>
<link>http://localhost/joomla-cms/index.php/park-blog/18-second-blog-post</link>
<guid isPermaLink="true">http://localhost/joomla-cms/index.php/park-blog/18-second-blog-post</guid>
<description><![CDATA[<p><em>Lorem Ipsum is text that is traditionally used by designers when working on a site before the content is ready.</em></p><p>Pellentesque bibendum metus ut dolor fermentum ut pulvinar tortor hendrerit. Nam vel odio vel diam tempus iaculis in non urna. Curabitur scelerisque, nunc id interdum vestibulum, felis elit luctus dui, ac dapibus tellus mauris tempus augue. Duis congue facilisis lobortis. Phasellus neque erat, tincidunt non lacinia sit amet, rutrum vitae nunc. Sed placerat lacinia fermentum. Integer justo sem, cursus id tristique eget, accumsan vel sapien. Curabitur ipsum neque, elementum vel vestibulum ut, lobortis a nisl. Fusce malesuada mollis purus consectetur auctor. Morbi tellus nunc, dapibus sit amet rutrum vel, laoreet quis mauris. Aenean nec sem nec purus bibendum venenatis. Mauris auctor commodo libero, in adipiscing dui adipiscing eu. Praesent eget orci ac nunc sodales varius.</p>]]></description>
<category>Park Blog</category>
<pubDate>Fri, 31 Dec 2010 23:00:01 +0000</pubDate>
<img src="http://localhost/joomla-cms/images/joomla_black.png"/></item>
</channel>
</rss>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment