From: Tomas Doran Date: Mon, 20 Jun 2011 14:19:29 +0000 (+0100) Subject: Remove suggestion to make RSS feeds with TT X-Git-Tag: 5.8008~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=commitdiff_plain;h=32cebe9b3da2a60f5b8fa62d15ba866ede0994f8 Remove suggestion to make RSS feeds with TT --- diff --git a/Changes b/Changes index 45b1492..f438eac 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,10 @@ Revision history for Catalyst-Manual + - Cookbook + - Remove suggestion to generate RSS feeds using Template Toolkit. + This is a horrible idea, and it's very very easy to generate an + invalid feed. + 5.8007 29 Feb 2011 - Tutorial - Switch to use of DBIx::Class::PassphraseColumn for hashed & salted diff --git a/lib/Catalyst/Manual/Cookbook.pod b/lib/Catalyst/Manual/Cookbook.pod index a17266f..96be531 100644 --- a/lib/Catalyst/Manual/Cookbook.pod +++ b/lib/Catalyst/Manual/Cookbook.pod @@ -965,43 +965,9 @@ different approaches here, but the basic premise is that you forward to the normal view action first to get the objects, then handle the output differently. -=head3 Using TT templates - -This is the approach used in Agave (L). - - sub rss : Local { - my ($self,$c) = @_; - $c->forward('view'); - $c->stash->{template}='rss.tt'; - } - -Then you need a template. Here's the one from Agave: - - - - - [ [% blog.name || c.config.name || "Agave" %] ] RSS Feed - [% base %] - Recent posts - en-us - 40 - [% WHILE (post = posts.next) %] - - [% post.title %] - [% post.formatted_teaser|html%] - [% post.pub_date %] - [% post.full_uri %] - [% post.full_uri %] - [% post.author.screenname %] - - [% END %] - - - =head3 Using XML::Feed -A more robust solution is to use L, as was done in the Catalyst -Advent Calendar. Assuming we have a C action that populates +Assuming we have a C action that populates 'entries' with some DBIx::Class iterator, the code would look something like this: @@ -1025,7 +991,7 @@ like this: $c->res->body( $feed->as_xml ); } -A little more code in the controller, but with this approach you're +With this approach you're pretty sure to get something that validates. Note that for both of the above approaches, you'll need to set the