Hi Simran...

        Bear in mind that doing this essentially defeats the main purpose of
templates in general, and HTML::Template in particular, which is, namely, to
separate logic from presentation. I've had situations where I've needed and
elsif here and there, but it's best left in the code.

        When I want to handle displaying error messages, I have a generic
template that displays status messages (not errors), so what you can do is
this:

Status: <TMPL_VAR NAME=STATUS>
Message: <TMPL_VAR NAME=MESSAGE>

        And then you display an appropriate message. Based on if/elsif/else
structures in your script. The nice thing about this is, you still only edit
your code and your template stays the same, so you don't have to edit your
code and template concurrently, thereby sticking to the edicts of using
templates. Also, this method doesn't tie you down to using it for displaying
only errors, you can use that one template to show all your status messages,
be they errors or success messages.

        Sam, I'd like to take this opportunity just to say thanks once more
for giving us all HTML::Template.

        TMTOWTDI :) HTH :)

> I have a template where i really need to use "else if" conditions? How
> do you all handle places where you need to use "else if"? 
> 
> A sample of my situation is: 
> 
>   <tmpl_if name="error1">
>     Error one occured
>   <tmpl_elseif name="error2">
>     Error two occured
>   <tmpl_else>
>     No error could be determined...
>   </tmpl_if>
> 
> If if was just two error messages, i could nest the if's but i have a
> situation where i might have hundreds!!!




"This e-mail may contain confidential information and may be legally
privileged and is intended only for the person to whom it is addressed. If
you are not the intended recipient, you are notified that you may not use,
distribute or copy this document in any manner whatsoever. Kindly also
notify the sender immediately by telephone, and delete the e-mail. When
addressed to clients of the company from where this e-mail originates ("the
sending company ") any opinion or advice contained in this e-mail is subject
to the terms and conditions expressed in any applicable terms of business or
client engagement letter . The sending company does not accept liability for
any damage, loss or expense arising from this e-mail and/or from the
accessing of any files attached to this e-mail." 


-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing 
your web site with SSL, click here to get a FREE TRIAL of a Thawte 
Server Certificate: http://www.gothawte.com/rd524.html
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users

Reply via email to