[Catalyst] Using $c->view('TT')->render for emails

Matt S Trout dbix-class at trout.me.uk
Wed Feb 7 09:28:54 GMT 2007


On 6 Feb 2007, at 22:53, Jim Spath wrote:

> In the docs for Catalyst::View::TT and Catalyst::Plugin::Email, it  
> suggests using $c->view('TT')->render() for the rendering of email  
> templates.
>
> My issue is that I created my Catalyst view with TTSite as  
> described in the CatalystBasics tutorial, and when I call the  
> render method on the email template, all of the site templates  
> (header, footer, etc) are pulled in, when all I really want is the  
> email template by itself.

The generated wrapper already tests for .js, .css to decide whether  
to add the header or not - if you add in some extra code that  
bypasses the wrapper when say c.stash.is_email_render exists you  
should be fine.

Creating another view so you can have a separate set of e-mail  
templates is also potentially a good option though - I've done both  
depending on how complex the mail integration in the app was.

-- 
Matt S Trout, Technical Director, Shadowcat Systems Ltd.
Offering custom development, consultancy and support contracts for  
Catalyst,
DBIx::Class and BAST. Contact mst (at) shadowcatsystems.co.uk for  
details.
+ Help us build a better perl ORM: http://dbix- 
class.shadowcatsystems.co.uk/ +





More information about the Catalyst mailing list