LemonStand Version 1 Has Been Discontinued
This documentation is for LemonStand Version 1. LemonStand is now offered as a cloud-based eCommerce platform.
You can try the new LemonStand and learn about upgrading here.
Implementing RSS channels
The blog module allows you to add two RSS channels to your website - the posts RSS channel and the comments RSS channel. The both channels should be implemented as regular CMS pages.
Creating the posts RSS channel
Create a new page and assign it some name and URL, for example /rss. Paste the following code to the Content field. No other HTML or PHP content is allowed.
<?=
Blog_Post::get_rss(
"My blog",
"My news and updates",
site_url('rss'),
site_url('blog/post'),
site_url('blog/category'),
site_url('blog'),
20);
?>The first and second parameters specify the RSS feed name and description.
In the parameters 3-6 you should specify URLs of the RSS channel page (this page), blog post page, blog category page and the blog root page (or archive page). The site_url() function outputs an absolute page URL, including the protocol.
The last parameters specifies how many blog posts to return in the RSS feed.
Creating the comments RSS channel
Create a new page and assign it some name and URL, for example /comments_rss. Paste the following code to the Content field. No other HTML or PHP content is allowed.
<?=
Blog_Post::get_comments_rss(
"My blog comments",
"Comments posted by the website visitors",
site_url('comments_rss'),
site_url('blog/post'),
site_url('blog/category'),
site_url('blog'),
20);
?>The parameters of the Blog_Post::get_comments_rss() method are similar to the parameters of the Blog_Post::get_rss() method described above.
Excluding specific categories from RSS channels
You can exclude blog posts belonging to specific categories with passing an array of category identifiers to Blog_Post::get_rss() and Blog_Post::get_comments_rss(). Example:
<?
// Exclude secret category from RSS feed
$category_ids = array();
$category = Blog_Category::create()->find_by_code('secret_category'); // Find the category by API code
if ($category)
$category_ids[] = $category->id;
echo Blog_Post::get_rss(
"My blog",
"My news and updates",
site_url('rss'),
site_url('blog/post'),
site_url('blog/category'),
site_url('blog'),
20,
$category_ids);
?>Next: Configuring the new comment notifications
Previous: Adding the comment form
Return to Blog module
