eZ Community » Forums » Feedback & ideas about the eZ... » RSS per blog
expandshrink

RSS per blog

RSS per blog

Wednesday 14 December 2011 12:50:55 pm - 4 replies

Hi,

Would it be possible to have a rss feed per blog? I need a rss feed for my blog for Linkedin. I have the code to implement it, if you are interested.

Wednesday 14 December 2011 3:28:01 pm

Hello Sebastiaan,

 

I suggest a custom implementation as the rss module does not help you here directly ... also simpler to implement I think without relying on the rss module (though you could try to trigger the creation of your feeds through it I imagine with enough work and a custom workflow event).

 

I've created similar rss feeds using custom extension module views (PHP) and /layout/set templates. Both have advantages and disadvantages ....

 

I hope this helps ...

 

Cheers,

Heath

Wednesday 14 December 2011 4:01:18 pm

For one site I did a custom edit handler for blogs, and called the following function from the 'publish function' (only for the first version of the blog object): 

 function createBlogRSS($object,$node,$rssName)
    {
        $userID = 14;
        $nodeID = $node->attribute( 'node_id' );
        $db = eZDB::instance(); 
        $db->begin();
        
            $rssExport = eZRSSExport::create($userID);            
            $rssExport->setAttribute( 'title', $object->attribute('name') );
            $rssExport->setAttribute( 'access_url', $rssName );
            $rssExport->setAttribute( 'url', "http://www.yourwebsite.com" );
            $rssExport->setAttribute( 'rss_version', "2.0");
            $rssExport->setAttribute( 'number_of_objects', 20 );
            $rssExport->setAttribute( 'active', 1 );
            $rssExport->setAttribute( 'status', 1 );
            $rssExport->setAttribute( 'main_node_only', 0 );
            $rssExport->store();
 
            $rssExportID = $rssExport->attribute( 'id' );
            $rssExportItem = eZRSSExportItem::create( $rssExportID );
            $rssExportItem->setAttribute( 'class_id', 16 );
            $rssExportItem->setAttribute( 'description', "bl_body_xmlb" );
            $rssExportItem->setAttribute( 'source_node_id', $nodeID );
            $rssExportItem->setAttribute( 'status', 1 );
            $rssExportItem->setAttribute( 'subnodes', 1 );
            $rssExportItem->setAttribute( 'title', "bl_title_txtl" );
            $rssExportItem->store();
        
        $db->commit();
        return $rssName;
    }

Modified on Wednesday 14 December 2011 4:16:18 pm by S V

Wednesday 14 December 2011 4:10:22 pm

Hello Sebastiaan,

 

Wow, that's fantastic!

That's exactly what I was thinking of!

Thank you very very much for sharing this example!

 

I hope this helps others also reach their own custom rss feed goals ...

 

Cheers,

Heath

Wednesday 14 December 2011 4:48:00 pm

I'll put this with some more details in a blog post as soon as I have some time.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from