Etomite Community Forums: [Snippet] RSS FEED - Etomite Community Forums

Jump to content

Read Me

This forum is posted in automatically when a snippet is added to the library, or updated. Please use the snippet topic to discuss that snippet.
  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

[Snippet] RSS FEED

#1 User is offline   Cris D. 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,076
  • Joined: 10-August 06
  • Gender:Not Telling

Posted 10 October 2007 - 07:15 AM

File Name: RSS FEED
File Submitter: Cris D.
File Submitted: 10 Oct 2007
File Updated: 18 Jan 2008
File Category: Blogs & News

Module: RSS FEED
Snippet: RSS V2.2
Template: rssTemplate
Author: Cris D
Date: 2007/11/10
Use: This snippet creates a validated RSS xml document that lets users create live links to selected pages in your site

Instructions:
1) Create a template with the template code following...
2) Create and publish a new page (uncached) with the rssTemplate called rssFeed.
3) In the rssFeed page under the publishing tab set content type: "text/xml".
4) Call this snippet in the rssFeed page uncached [!rssFeed2.0!]
5) Eto 1.6.0+Set in the index.php: $etoNotice=false Eto 1.0+ set in manager config Display Linkback-Off.
6) Configure the snippet as per in-snippet documentation
7) Create a link (rss image or hyperlink) to the document rssFeed In a compatible browser, the user will be prompted to "bookmark the feeds" or "subscribe to this feed".

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"


A word about cached snippets on linked pages: If your RSS feed snippet is called [[cached]] and you have a single [!uncached!] snippet on the linked page, just the page 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.


Changelog:
V1.3 Updated 2007/11/06
  • Made changes so the feed validates
  • Added Atom namespace to template
  • Now calling site keywords to fill <content> element
  • WebMaster (real name) now must be hard coded
  • RFF882 publishing date set by default
  • isPermaLink case error fixed
  • $feedLink now using makeURL instead of $GLOBALS['www_base_path']

RSSFeedV2.0 2007/11/10
  • Built a simple etomite parser that displays the results of cached snippets on linked pages.
  • Changed the installation from a snippet call in the template, to the snippet call on the page being used as the feed link.
  • You can now set a parent folder for all children to include or set individual pages
  • Added an Etomite notice to the bottom of the feed.


RSSFeed 2.1 2007/11/10
  • Updated content with <![CDATA[]]> attribute
  • Removed htmlentities (not required with CDATA declaration)
  • Fixed unvalidating etoNotice


RSSFeed2.2 2008/01/18
  • Added the capability to read a feed page identified by placing RSS or rss in the documents' keyword
  • Note: If RSS is found on a single page, the $itemLinks and $parent configuration methods are now ignored.
  • Implemented Jim Browski's $blogLinkId suggestion as a html site anchor.



For a good guide to the configurable elements used in this snippet (and more that you can add), see... http://cyber.law.har...du/rss/rss.html

For more assistance, see the in-snippet documentation.

See it in action

Click here to download this file

This post has been edited by Cris D.: 04 December 2008 - 08:20 AM


#2 User is offline   Jim Browski 

  • Likes Etomite Forums!
  • PipPip
  • Group: Member
  • Posts: 163
  • Joined: 07-September 05
  • Location:Germany

Post icon  Posted 05 November 2007 - 09:02 PM

View PostCris D., on Oct 10 2007, 09:15 AM, said:

This snippet creates an RSS2.0 , xml 1.0 document ...

I checked your demo feed at http://www.artimental.com/rssFeeds.html with some feed validators. They do not seem to be standard-compliant. Beside some mime type issues (which are negligible) there is a problem with the use of the "isPermalink"-Attribute.

See the validation results at
Validome
Feed Validator

#3 User is offline   Cris D. 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,076
  • Joined: 10-August 06
  • Gender:Not Telling

Posted 05 November 2007 - 10:40 PM

Thanks, I didn't know that there was a feed validator (I must admit, I never looked). The guid validation problem is a simple Case issue: isPermalink should be isPermaLink. I'll review it and update the snippet. Thanks for the feedback.

#4 User is offline   Cris D. 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,076
  • Joined: 10-August 06
  • Gender:Not Telling

Posted 06 November 2007 - 10:18 AM

Snippet updated with several improvements including: support for Atom, site Keywords for <content>, now a validating RSS feed.

#5 User is offline   Cris D. 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,076
  • Joined: 10-August 06
  • Gender:Not Telling

Posted 07 November 2007 - 05:00 AM

Just realised that etomite has a automatic character encoding feature:
[(etomite_charset)] will automatically get the correct encoding from the database when placed in the template for this snippet:
<?xml version="1.0"  encoding="[(etomite_charset)]"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
[!rssContent!]
</channel>
</rss>

This post has been edited by Cris D.: 07 November 2007 - 07:43 AM


#6 User is offline   mikef 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,549
  • Joined: 30-August 05
  • Gender:Male
  • Location:Cheshire, UK
  • Interests:Photography, Gardening for Wildlife

Posted 08 November 2007 - 03:10 PM

Hi Chris,
I've been toying with the idea of using RSS on galleries, but information needed seemed to be spread all over the web, with lots of different standards.
Is there any particular reason you've chosen the Atom namespace rather than an RSS namespace?

Also, is there a reason for creating a template that contains everything, and using a completely empty document? (I'd want some stuff parameterised, otherwise I'd have to create several different templates. (I don't want to create just a single feed for a whole site)

#7 User is offline   Cris D. 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,076
  • Joined: 10-August 06
  • Gender:Not Telling

Posted 08 November 2007 - 08:27 PM

Hi mikef,
Adding the Atom namespace makes is compatible with more aggregators (it does not exclude others by having it there). It is also RSS2.0. This was a recommendations by veridome validator which W3C validator did not object to.

In terms of having the empty content page, this was to have complete control over the output from the snippet and make installation (and snippet authoring) easier. As long as the mime type is set to text/xml in the page the tempate can have [*content*] and the snippet can be on that page. Doing this and adding tweaks to the snippet to let you add snippet calls will let you do pretty much whatever you want for your feed for individual pages.

This snippet does NOT automatically feed every page in the site, it only adds pages that you explicitly add to the config settings in the snippet. However, it would not be that hard to spit out every page automatically if that was required by someone.

I'm still in the process of getting a feed going (will be the next version) that will evaluate all snippets instead of only cached snippets 1 level deep. This will probably be the main issue with using this RSS Feed snippet on your sites: because of images (and info) being displayed by nested snippets.

This post has been edited by Cris D.: 08 November 2007 - 08:45 PM


#8 User is offline   mikef 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,549
  • Joined: 30-August 05
  • Gender:Male
  • Location:Cheshire, UK
  • Interests:Photography, Gardening for Wildlife

Posted 08 November 2007 - 09:19 PM

Thanks Cris - I'll use atoms if possible then!
I'm not planning to use your snippet, as I don't want the feed to be which pages have changed - thats very complex to determine on my sites (where most pages are made almost entirely from snippet calls) and many pages have multiple presentations depending on parameters in the URL.
What I want to do is generate feeds for:
new artworks on the site as a whole, with the links going to the sub page for the specific artwork
new artworks for specific artworks, with links again going to the specific artwork

I'll probably end up pinching a lot from your snippet, but the end result will only be usable with etogal galleries (and, if at all possible, will use etogalthumb.

the biggest potential problem is if the Atom and/or RSS DTDs require a date for each item, as etogal doesn't store creation date. Its years since I last had to read a DTD!

#9 User is offline   Cris D. 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,076
  • Joined: 10-August 06
  • Gender:Not Telling

Posted 08 November 2007 - 10:38 PM

You might like to read this: RSS2.0 only REQUIRES title, description and link. Everything else (including date) is optional. By setting the TTL (time to live) the page in the feed is automatically refreshed. This will include new pictures if added in that time. Cached snippets will work in the feed. What you are describing is definately do-able.

#10 User is offline   mikef 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,549
  • Joined: 30-August 05
  • Gender:Male
  • Location:Cheshire, UK
  • Interests:Photography, Gardening for Wildlife

Posted 08 November 2007 - 11:02 PM

Agreed, looks definitely doable. Expect something over the weekend. Thanks Cris!

#11 User is offline   Cris D. 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,076
  • Joined: 10-August 06
  • Gender:Not Telling

Posted 09 November 2007 - 02:48 PM

Snippet updated with a mini-parser that shows cached snippet content in the feeds. Also added the ability to set a feed 'parent' Added an etoNotice to the feed output. Also changed the template and snippet to work together so that the temlpate calls the [*content*] instead of the [!snippet!] to avoid confusion and assist in parsing levels.

#12 User is offline   Jim Browski 

  • Likes Etomite Forums!
  • PipPip
  • Group: Member
  • Posts: 163
  • Joined: 07-September 05
  • Location:Germany

Post icon  Posted 12 November 2007 - 04:24 PM

View PostCris D., on Nov 6 2007, 11:18 AM, said:

Snippet updated with several improvements including: support for Atom, site Keywords for <content>, now a validating RSS feed.

Thank you very much!
Now it even validates as a RSS 2.0 Feed using the very strict validator at validome.org: Check!

As a validation- and standards-junkie i'm very happy now :D

JB.

#13 User is offline   Jim Browski 

  • Likes Etomite Forums!
  • PipPip
  • Group: Member
  • Posts: 163
  • Joined: 07-September 05
  • Location:Germany

Posted 12 November 2007 - 04:54 PM

View PostCris D., on Nov 8 2007, 09:27 PM, said:

Adding the Atom namespace makes is compatible with more aggregators (it does not exclude others by having it there). It is also RSS2.0. This was a recommendations by veridome validator which W3C validator did not object to.

Playing around with this snippet and Google Reader i encountered a behaviour that might not be intented.

The <atom:link> and <link> element both use the url generated by etomite depending on the Feed-ID. The Google Reader creates a clickable heading for a feed depending on <link>, so if you click on that heading, you are redirected to the rss feed output. I think it would be better to be redirected to an html-overview (think of the startpage of a blog). This is how most blogs output their feeds.

The described behaviour is easy to archive. I propose the following:

1. Add a new parameter "blogLinkId" in the header variables like this
$feedLinkId='13'; // Set to the page id of the published page using the rss template.
$blogLinkId='26'; // Set to the page id of a html-entry-overview (e.g. your Blog-Homepage).

2. Let etomite generate an url for the blogLinkId:
$feedLink=$etomite->makeURL($feedLinkId,'','');
$blogLink=$etomite->makeURL($blogLinkId,'','');

3. Change use of variables in the rss header like this:
<atom:link href="$feedLink" rel="self" type="application/rss+xml" />
<link>$blogLink</link>

That's it.
BTW, did i say that your snippet is great? :D

#14 User is offline   Cris D. 

  • Loves Etomite Forums!
  • PipPipPipPip
  • Group: Member
  • Posts: 1,076
  • Joined: 10-August 06
  • Gender:Not Telling

Posted 17 January 2008 - 04:52 PM

Snippet updated with this recommendation for a $blogLinkId, thanks for the idea Jim.

Also updated with the ability to place "rss" or "RSS" into a document's keyword where it will now be picked up and automatically added to the feed (at the expense of the folder parent or manual id's...see the snippet documentation for a better explanation). Thanks for the idea Karen.

#15 User is offline   RobCinOz 

  • Etomite Forum Newbie
  • Group: Member
  • Posts: 20
  • Joined: 14-June 06
  • Location:Worrigee NSW Australia

Post icon  Posted 24 February 2008 - 01:13 PM

I'd like to link RSS FEED to a directory (assets/podcasts) to podcast mp3 files of guest speakers that my client records. Then I can delegate the uploading of the mp3 files to someone that does not have manager access (the man that does the recording). I'll use the "FrontEndFileManager" snippet to allow the uploads.

1. Can this be done (linking to directory)?

2. How?

Share this topic:


  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users