[eluser]tfncruz[/eluser]
Hi!
I followed Derek's way of implementing RSS. But something is wrong and I cannot see what it is.
The content inside the "description" tag doesn't show in the rss view.
Here's the controller:
Code:
<?php
class Autores_rss extends Controller {
function Autores_rss() {
parent::Controller();
$this->load->model('autores_model');
$this->load->helper('xml');
}
function index() {
$data['encoding'] = 'utf-8';
$data['feed_name'] = 'Autores na Página Literária do Porto';
$data['feed_url'] = 'http://www.paginaliterariadoporto.com';
$data['page_description'] = 'Últimos autores adicionados à Página Literária do Porto';
$data['page_language'] = 'pt';
$data['creator_email'] = 'Tiago Cruz - tfncruz at gmail dot com';
$data['autores'] = $this->autores_model->get_ultimos(10);
header("Content-Type: application/rss+xml");
$this->load->view('autores_rss_view', $data);
}
}
?>
Here's the view:
Code:
<?php echo '<?xml version="1.0" encoding="utf-8"?>' . "\n"; ?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:admin="http://webns.net/mvcb/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title><?php echo $feed_name; ?></title>
<link><?php echo $feed_url; ?></link>
<description><?php echo $page_description; ?></description>
<dc:language><?php echo $page_language; ?></dc:language>
<dc:creator><?php echo $creator_email; ?></dc:creator>
<dc:rights>Copyright <?php echo gmdate("Y", time()); ?></dc:rights>
<admin:generatorAgent rdf:resource="http://www.codeigniter.com/" />
<?php foreach($autores as $row): ?>
<item>
<title><?php echo $row->nome; ?></title>
<link><?php echo base_url().'index.php/autor_main/pp/'.$row->autorID; ?></link>
<description><?php xml_convert($row->excerto); ?></description>
<pubDate><?php echo $row->dh; ?></pubDate>
</item>
<?php endforeach; ?>
</channel>
</rss>
There's nothing wrong with the model... the get_ultimos() function returns the latest 10.
Another thing... if I substitute xml_convert($row->excerto) with echo "lalala", "lalala" appears correctly on all items...
Any ideas?
Thanks in advance!