Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

RSS feed

Go to End

4 Posts   1665 Views


Community Member, 3 Posts

15 June 2008 at 3:25pm

Could anyone help me?
I have rss feed for my website but it is showing 10 full articles. I need, that in RSS feed would be shown only 10 titles of articles and only first paragraph of article. Please write the code, it would be great!


Forum Moderator, 5523 Posts

15 June 2008 at 4:04pm

When you create a RSS feed you do something like this... (taken from the blog module)

$rss = new RSSFeed($children, $this->Link(), $project . " blog", "", "Title", "ParsedContent");

The last argument in that list points to a method on BlogEntry which produces the content. So say you want the RSS Feed to show the first paragraph you could change that new RSS Feed to something like...

$rss = new RSSFeed($children, $this->Link(), $project . " blog", "", "Title", "MyShortContent");

Then on whatever Page type you are making the RSS feed of (for example a RSS feed of latest NewsPages) you would open up the NewsPages.php file and write a MyShortContent Method in the main class - not the controller that goes something like

function MyShortContent() {
return $this->Content->FirstParagraph();

Which will return the first paragraph of text from Content. Hopefully something like that will work for you!


Community Member, 3 Posts

15 June 2008 at 6:09pm

I can't understand...
I have page.php in which is rss feed.

The page.php source:

class Page extends SiteTree {
static $db = array(
'Date' => 'Date',
'Author' => 'Text'

static $has_one = array(

static $icon = "themes/treeicons/news";

class Page_Controller extends ContentController {
function project() {
global $project;
return $project;

function init() {
RSSFeed::linkToFeed($this->Link() . "rss", " - informacinis portalas");

function rss() {
$rss = new RSSFeed($this->Latest(), $this->Link(), " - informacinis portalas", " - informacinis portalas", "Title", "Content" , "Author");

function Latest() {
return DataObject::get("Page", "", "Created DESC", "", 10);



And I need that latest articles would be only from title and first paragraph of article...


Forum Moderator, 5523 Posts

15 June 2008 at 6:34pm

Sorry, my idea didnt even work when I tried it :( should stop coding off the top of my head!