CodeIgniter Forums
RSS not displaying description - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: RSS not displaying description (/thread-21496.html)



RSS not displaying description - El Forum - 08-11-2009

[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>
    
    &lt;title&gt;&lt;?php echo $feed_name; ?&gt;&lt;/title&gt;
    &lt;link&gt;&lt;?php echo $feed_url; ?&gt;&lt;/link&gt;
    <description>&lt;?php echo $page_description; ?&gt;</description>
    <dc:language>&lt;?php echo $page_language; ?&gt;</dc:language>
    <dc:creator>&lt;?php echo $creator_email; ?&gt;</dc:creator>

    <dc:rights>Copyright &lt;?php echo gmdate("Y", time()); ?&gt;</dc:rights>
    <admin:generatorAgent rdf:resource="http://www.codeigniter.com/" />
    
    &lt;?php foreach($autores as $row): ?&gt;
    
        <item>
        &lt;title&gt;&lt;?php echo $row->nome; ?&gt;&lt;/title&gt;
        &lt;link&gt;&lt;?php echo base_url().'index.php/autor_main/pp/'.$row->autorID; ?&gt;&lt;/link&gt;
        <description>&lt;?php xml_convert($row->excerto); ?&gt;</description>
          <pubDate>&lt;?php echo $row->dh; ?&gt;</pubDate>
        </item>
        
    &lt;?php endforeach; ?&gt;
    
    </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!


RSS not displaying description - El Forum - 08-11-2009

[eluser]tomcode[/eluser]
Guess You need to echo xml_convert().


RSS not displaying description - El Forum - 08-11-2009

[eluser]tfncruz[/eluser]
ups... you're right :S I really need a break!
Thank you very much!


RSS not displaying description - El Forum - 08-12-2009

[eluser]Phil Sturgeon[/eluser]
The best advice anyone can give you in programming is "learn to debug".

Lots of stuff randomly wont work in a project, just output variables and values at every level until you work out where its going wrong.