17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1295 Views |
-
RSS feed

15 June 2008 at 3:25pm
Hello,
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! -
Re: RSS feed

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!
-
Re: RSS feed

15 June 2008 at 6:09pm
I can't understand...
I have page.php in which is rss feed.The page.php source:
<?phpclass 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", "e-sviesa.lt - informacinis portalas");
parent::init();
Requirements::themedCSS("layout");
Requirements::themedCSS("typography");
Requirements::themedCSS("form");
}
function rss() {
$rss = new RSSFeed($this->Latest(), $this->Link(), "e-sviesa.lt - informacinis portalas", "e-sviesa.lt - informacinis portalas", "Title", "Content" , "Author");
$rss->outputToBrowser();
}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...
-
Re: RSS feed

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!
| 1295 Views | ||
|
Page:
1
|
Go to Top |


