rss This Page
Snippet: RSSFeedThisPage V1.2
Author: Cris D
Date: 2008/02/28
Use: This snippet creates a validated RSS xml document that lets users create live links to every page on your site, one at a time. By using this snippet, you are allowing users to control which pages they can set as RSS. If you want to decide which pages to feed out, use the other RSS snippet RSSFeed.
CHANGELOG:
2008/07/05: Fixed XSS vunerability line 80.
Instructions:
1) Create a template with the template code following... if you have this for the original rss snippet, it you can re-use it OK
2) Create and publish a new page (uncached) using the rssLinkThisPage template called rssThisPage.(note the documentId).
3) In the rssThisPage page under the publishing tab set content type: "text/xml".
4) Call the snippet in the rssThisPage page uncached [!rssThisPage!]
5) Set in the index.php: $etoNotice=false
6) Configure the snippet as per in-snippet documentation (including setting the id of the $feedLinkId- the same as rssThisPageLink snippet).
7) Place the rssThisPage snippet cached[[rssThisPageLink]] in the template of your site so the link will show on every page. You can use the a href or form output... When a user clicks on the link or image, they will see a single page rss feed for the page they are on.
Create a template with the following code:
Create a link to your rss feed for that page by placing a link in yout site template: saving this as a snippet [[rssThisPageLink]]
Option 1)
Option 2)
Author: Cris D
Date: 2008/02/28
Use: This snippet creates a validated RSS xml document that lets users create live links to every page on your site, one at a time. By using this snippet, you are allowing users to control which pages they can set as RSS. If you want to decide which pages to feed out, use the other RSS snippet RSSFeed.
CHANGELOG:
2008/07/05: Fixed XSS vunerability line 80.
Instructions:
1) Create a template with the template code following... if you have this for the original rss snippet, it you can re-use it OK
2) Create and publish a new page (uncached) using the rssLinkThisPage template called rssThisPage.(note the documentId).
3) In the rssThisPage page under the publishing tab set content type: "text/xml".
4) Call the snippet in the rssThisPage page uncached [!rssThisPage!]
5) Set in the index.php: $etoNotice=false
6) Configure the snippet as per in-snippet documentation (including setting the id of the $feedLinkId- the same as rssThisPageLink snippet).
7) Place the rssThisPage snippet cached[[rssThisPageLink]] in the template of your site so the link will show on every page. You can use the a href or form output... When a user clicks on the link or image, they will see a single page rss feed for the page they are on.
A word about cached sippets on linked pages: If your RSS feed snippet is called [[cached]]
and you have a single [!uncached!] snippet on the linked page, just the title is returned.
If your RSS feed is called [!uncached!] and you have [!uncached!] snippets on the linked page,
the snippet call is displayed and the rest of the page is also shown including evaluated
[[cached]] snippets. Therefore, for best results use this snippet [!uncached!] and all snippets on
linked pages [[cached]] unless you have good reason to do otherwise.
Create a template with the following code:
<?xml version="1.0" encoding="[(etomite_charset)]"?> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" > <channel> [*content*] </channel> </rss>Save it as "rssTemplate" (if you already have this template from the original rss snippet you can use it).
Create a link to your rss feed for that page by placing a link in yout site template: saving this as a snippet [[rssThisPageLink]]
Option 1)
//rssThisPageLink snippet option 1) Use a href link $feedLinkId='148';//set to the page id of the published page using the rssThisPage template. $output ="<a href=\"".$etomite->makeURL($feedLinkId,'',"?rssThisPage=".$etomite->documentIdentifier."")."\">"; $output .="<img src=\"assets/images/rss.gif\" alt=\"rss\" /></a>"; //set path to an image if you want return $output;
Option 2)
//rssThisPageLink snippet option 2) Use a form as an rss link $feedLinkId='148';//set to the page id of the published page using the rssThisPage template. $output .="<form action=\"".$etomite->makeURL($feedLinkId,'','')."\" method=\"get\">"; $output .="<input type=\"hidden\" name=\"rssThisPage\" value=\"".$etomite->documentIdentifier."\" >"; $output .="<input type=\"submit\" value=\"RSS\">"; $output .="</form>"; return $output;
- 250
- 19
- 51
- 134,335
- listpics
- vampke











