pauamma: Cartooney crab holding drink (Default)
Res facta quae tamen fingi potuit ([personal profile] pauamma) wrote in [site community profile] dw_dev_training 2011-09-21 09:13 pm (UTC)

You can't call Perl code directly from templates, so you have 2 solutions, I think:
- have your controller pass variables to your template indicating which beta features the user has turned on. Then you can do something like [% IF uaerhasbeta.featurename %] [% dw.need_res( 'js/featurename.js' ) %] [% ENDIF %] (syntax not guaranteed)
- write a TT plugin (see cgi-bin/DW/Template/Plugin.pm and cgi-bin/DW/Template/Plugin/*) (being vague here, because I'm unsure of my footing)

Which is best depends on how many templates would need to test for beta features and whether this change is strictly localized to the templates, or if it affects the controllers as well.

Post a comment in response:

From:
Anonymous( )Anonymous This account has disabled anonymous posting.
OpenID( )OpenID You can comment on this post while signed in with an account from many other sites, once you have confirmed your email address. Sign in using OpenID.
User
Account name:
Password:
If you don't have an account you can create one now.
Subject:
HTML doesn't work in the subject.

Message:

 
Notice: This account is set to log the IP addresses of everyone who comments.
Links will be displayed as unclickable URLs to help prevent spam.