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.
01.
<?=
02.
Blog_Post::get_rss(
03.
"My blog"
,
04.
"My news and updates"
,
05.
site_url(
'rss'
),
06.
site_url(
'blog/post'
),
07.
site_url(
'blog/category'
),
08.
site_url(
'blog'
),
09.
20);
10.
?>
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.
01.
<?=
02.
Blog_Post::get_comments_rss(
03.
"My blog comments"
,
04.
"Comments posted by the website visitors"
,
05.
site_url(
'comments_rss'
),
06.
site_url(
'blog/post'
),
07.
site_url(
'blog/category'
),
08.
site_url(
'blog'
),
09.
20);
10.
?>
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:
01.
<?
02.
// Exclude secret category from RSS feed
03.
$category_ids
=
array
();
04.
$category
= Blog_Category::create()->find_by_code(
'secret_category'
);
// Find the category by API code
05.
if
(
$category
)
06.
$category_ids
[] =
$category
->id;
07.
08.
echo
Blog_Post::get_rss(
09.
"My blog"
,
10.
"My news and updates"
,
11.
site_url(
'rss'
),
12.
site_url(
'blog/post'
),
13.
site_url(
'blog/category'
),
14.
site_url(
'blog'
),
15.
20,
16.
$category_ids
);
17.
?>
Next: Configuring the new comment notifications
Previous: Adding the comment form
Return to Blog module