On 31.08.2009, at 15:22, GRolf wrote:

the docs say about "tal:condition" that the block will only be shown
if the expression evaluates to true...

but I don't find the info if I couldn't easily compare a var to a
string?

should I always revert to php: stringname == 'value' ?

Yes. That's fine.

Something like

<div class="errormsg" tal:condition="errmsg:'unknonwn_user'"> Your
username is unknown</div>

If you want your error strings to be independent from text displayed in the interface, that looks like translation and PHPTAL's i18n functionality might be best for it:

<div class="errormsg" i18n:translate="errmsg"/>

and create your own translation service class (or use gettext) that maps "unknonwn_user" to "Your username is unknown".


Another approach is to pass boolean values to the template (or object that has methods that return exact information you want):

<div class="errormsg" tal:condition="is_unknonwn_user'"> Your username is unknown</div>


--
regards, Kornel




_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to