[Catalyst] How use two wrapper?

Ben van Staveren benvanstaveren at gmail.com
Sun Jun 6 09:26:56 GMT 2010


Either set a stash variable indicating which wrapper you want to use, 
and modify your wrapper.tt2 as follows:

[% IF stash_variable == 'thiswrapper' %]
  [% WRAPPER thiswrapper.tt2 %]
    [% content %]
  [% END %]
[% ELSE %]
  [% WRAPPER thatwrapper.tt2%]
    [% content %]
  [% END %]
[% END %]

or just get rid of it altogether and set the right one in your templates.

Xiao Yafeng wrote:
> Hi,
>       I'm new to Catalyst. I'd like to use one wrapper to some 
> templates, the other wrapper to some other templates. But as 
> Catalyst;:Manual::Tutorial, 
>
> I can only define one wrapper like this:
>                     __PACKAGE__->config(
>         # Change default TT extension
>         TEMPLATE_EXTENSION => '.tt2',
>         # Set the location for TT files
>         INCLUDE_PATH => [
>                 MyApp->path_to( 'root', 'src' ),
>             ],
>         # Set to 1 for detailed timer stats in your HTML as comments
>         TIMER              => 0,
>         # This is your wrapper template located in the 'root/src'
>         WRAPPER => 'wrapper.tt2',
>     );
> Thanks In advance!
> ------------------------------------------------------------------------
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>   

-- 
Ben van Staveren
phone: +62 81 70777529
email: benvanstaveren at gmail.com




More information about the Catalyst mailing list