[Catalyst] Best prcatice: same back-end, different UI

Jason Galea lists at eightdegrees.com.au
Wed Mar 9 06:13:59 GMT 2011


Hi Julien,

I've used a couple of different tactics..

assuming you are subclassing Catalyst::View::TT for your view you can do:

  $c->stash->{additional_template_paths} = [$c->config->{root}.'/'.$theme_dir];

in your controller, auto, chain, whatever. This will tell TT to look
for templates there first.

You can also hook right into TT utilising the fact that the
INCLUDE_PATHS config can be filled dynamically..

http://template-toolkit.org/docs/manual/Config.html#section_INCLUDE_PATH

my $template = Template->new({
    INCLUDE_PATH => [ '/usr/local/templates',
                      \&incpath_generator,
                      My::IncPath::Generator->new( ... ) ],
});

cheers,

J

On Wed, Mar 9, 2011 at 2:48 PM, Julien Sobrier <julien at sobrier.net> wrote:
> Hello,
> I have multiple domain names tight to the same back-end. I'd like to
> be able to present different templates based on:
> * the domain name
> * the language (not just a translation)
> * user agent (mobile version)
>
> I am wondering what is the best way to achieve this.
>
> Thanks
> Julien
>
> _______________________________________________
> 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/
>



-- 
Jason Galea
Web Developer

Ph 07 40556926
Mob 04 12345 534
www.eightdegrees.com.au



More information about the Catalyst mailing list