CodeIgniter Forums
RSS Question - 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 Question (/thread-9550.html)



RSS Question - El Forum - 06-29-2008

[eluser]adamfairholm[/eluser]
CI Peepz, I've got a problem. If anyone has an answer, it would be very much appreciated.

I have an RSS feed I've created for someone, and it validates and everything is all cool. Same with the Atom feed. Here is the RSS feed:

http://www.ceosforcities.org/feeds/rss/blog

Here is the atom:

http://www.ceosforcities.org/feeds/atom/blog

As you might be able to guess from the URL, these are being generated from a controller and then generated in a view from a database.

So it shows up fine everywhere, but our client is all about Netvibes. Netvibes doesn't like these RSS feeds. Doesn't show the last 4 or so on the RSS feed, and maybe the last 1 on the atom, although it handles the Atom much better. I know Netvibes has a bit of delay, but on RSS its not just the delay - its been a few days. It just plain refuses to update the last few. Very strange.

Now here is the funny part, the RSS feed we created replaced an old feed, and the new feed is identical to the old one in every way. The old on apparently had no update problems.

I'm really confused as to why this is happening. Can anyone venture a guess?


RSS Question - El Forum - 06-30-2008

[eluser]Yash[/eluser]
Can you show us some code please?


RSS Question - El Forum - 06-30-2008

[eluser]adamfairholm[/eluser]
Yes, here is the code generating the rss feed:

Code:
<?php
echo '<?xml version="1.0" encoding="utf-8"?>' . "
";
?>

<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:c>

    <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>
    <pubDate>&lt;?php echo rss_date_format($last_date);?&gt;</pubDate>
    <lastBuildDate>&lt;?php echo rss_date_format($last_date);?&gt;</lastBuildDate>
    <language>&lt;?php echo $page_language; ?&gt;</language>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <managingEditor>&lt;?php echo $creator_email; ?&gt;</managingEditor>

    <dc:rights>Copyright &lt;?php echo gmdate("Y", time()); ?&gt;</dc:rights>
    <a>

    &lt;?php foreach($posts->result() as $entry): ?&gt;
    
        <item>

          &lt;title&gt;&lt;?php echo xml_convert($entry->title); ?&gt;&lt;/title&gt;
          &lt;link&gt;&lt;?php echo $this->config->item('link_url').$type."/entry/".$entry->id ?&gt;&lt;/link&gt;
          <guid>&lt;?php echo $this->config->item('link_url').$type."/entry/".$entry->id ?&gt;</guid>

          <description>&lt;![CDATA[
      &lt;?=$entry->body;?&gt;
      ]]></description>
      <pubDate>&lt;?=rss_date_format($entry->created_on)?&gt;</pubDate>
        </item>
        
    &lt;?php endforeach; ?&gt;
    
    </channel></rss>

And here is the code generating the atom feed:

Code:
&lt;?php
echo '&lt;?xml version="1.0" encoding="utf-8"?&gt;' . "
";
?&gt;

<feed >

&lt;title&gt;&lt;?=$feed_name;?&gt;&lt;/title&gt;
<subtitle>&lt;?=$page_description;?&gt;</subtitle>
&lt;link href="http://www.ceosforcities.org/&lt;?=$type;?&gt;" rel="self"/&gt;
&lt;link href="http://ceosforcities.org/"/&gt;
<updated>&lt;?=atom_date($last_date);?&gt;</updated>
<a>
   <name>CEOs For Cities</name>
   <email>&lt;?=$creator_email;?&gt;</email>
</author>
<id>&lt;?php if($type=="blog"){ ?&gt;tag:www-ceosforcities-org,2008:/conversations/blog//1&lt;?php }else{?&gt;tag:www-ceosforcities-org,2008:/&lt;?=$type;?&gt;&lt;?php } ?&gt;</id>



    &lt;?php foreach($posts->result() as $entry): ?&gt;

<entry>

   &lt;title&gt;&lt;?=$entry->title;?&gt;&lt;/title&gt;

    &lt;link rel="alternate" type="text/html" href="&lt;?php echo $this-&gt;config->item('link_url').$type."/entry/".$entry->id ?&gt;" />
    &lt;link rel="service.edit" type="application/atom+xml" href="&lt;?php echo $this-&gt;config->item('link_url').$type."/entry/".$entry->id ?&gt;" title="&lt;?=$entry->title;?&gt;" />

  
   <id>&lt;?php if($entry->entry_atom_id){ echo $entry->entry_atom_id;} else{?&gt;tag:www.ceosforcities.org,&lt;?=dashes($entry->created_on);?&gt;:/&lt;?=$type;?&gt;/entry/&lt;?=$entry->id;?&gt;&lt;?php } ?&gt;</id>
  
   <published>&lt;?=atom_date($entry->created_on);?&gt;</published>
   <updated>&lt;?=atom_date($entry->created_on);?&gt;</updated>
  
   <summary>&lt;![CDATA[&lt;?=strip_tags(word_limiter($entry->body, 100));?&gt;]]></summary>
   <a>
       <name>CEOs for Cities</name>
       <uri>http://www.ceosforcities.org</uri>
   </author>
   <content type="html" xml:lang="en" xml:base="http://www.ceosforcities.org/conversations/blog/">
        &lt;![CDATA[&lt;?=$entry->body;?&gt;]]>
   </content>
</entry>

    &lt;?php endforeach; ?&gt;

</feed>

atom_date, rss_date_format, and dashes are just formatting a the date from a datetime stamp. The output validates, and you can see that in the Atom/RSS feed output I linked to above.

The atom feed is also designed to smoothly work with the old one, hence some maneuvering around to keep old atom ids.


RSS Question - El Forum - 06-30-2008

[eluser]Yash[/eluser]
I can't find any error..or something

only a tip although you know it..
Code:
&lt;?php echo
should be replaced with [code]&lt;?=[code]

just hang on someone will help u here for sure.. Smile


RSS Question - El Forum - 06-30-2008

[eluser]parrots[/eluser]
Might not be of much help but I loaded your RSS feed in Netvibes and I got 30 items, including what seems to be your oldest item in the item "Great Cities Attract Ambitious People." Dunno if I'm missing something but it looks ok to me?


RSS Question - El Forum - 06-30-2008

[eluser]adamfairholm[/eluser]
After a lot of banging my head against the wall, it appears that Netvibes can sometimes have a problem with an RSS feed that is just coming from a url without a file extension.

For example, this didn't seem to work:

http://www.thesite.com/feeds/rss/

But this worked fine:

http://www.thesitecom/feeds/rss.xml

Thanks Yash and Parrots for taking a look at this - I really appreciate it. The info of trying switching your RSS feed to have a file extension is nowhere to be found on the net so hopefully this is helpful to someone at some point. Doesn't make sense, I know, but Netvibes was having a terrible time updating it correctly for some reason.


RSS Question - El Forum - 08-19-2008

[eluser]vinod_ci[/eluser]
Hello guys
i want to write view in a file.
The view contains all data
<summary>&lt;![CDATA[&lt;?=strip_tags(word_limiter($entry->body, 100));?&gt;]]></summary>

$data=$this->load->view('ss/rss',$data,true);

if ( ! write_file('file.php', $data)Wink
{
echo 'Unable to write the file';
}
else
{
echo 'File written!';
}

The file.php contain "Array" text.

My questions is how to write view in a file.


RSS Question - El Forum - 08-19-2008

[eluser]mdowns[/eluser]
@vinod_ci: Please start your own thread.