List Info

Thread: Thinking the smarty way




Thinking the smarty way
user name
2007-02-09 15:25:19
I've got a very simple web app which performs a single
action and  
then outputs the result (success or failure). The failure
result can  
take one of three somewhat different forms:

1. It can output multiple error strings

     Sorry, your request has failed because:

     <ul>
         {foreach from=$errors item=error}
             <li>{$error}</li>
         {/foreach}
     </ul>

2. It can output a single error

     Sorry, you request has failed because the information
could not  
be obtained at this time.

3. It can output a single error message with an error code

     Sorry, your request has failed because:
      (  )


The question is, should these three different forms be one,
two or  
three different templates...?

Of course, if it is less then three templates, I would need
to place  
some logic in the template to output the right thing.

What is the generally accepted 'best practice' in this
situation?

Thank you.

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: Thinking the smarty way
user name
2007-02-12 03:19:44
Hello Eric,

I would use smarty-logic and a single template...

Ciao,
Peggy

Eric Gorr schrieb:
> I've got a very simple web app which performs a single
action and  then 
> outputs the result (success or failure). The failure
result can  take 
> one of three somewhat different forms:
> 
> 1. It can output multiple error strings
> 
>     Sorry, your request has failed because:
> 
>     <ul>
>         {foreach from=$errors item=error}
>             <li>{$error}</li>
>         {/foreach}
>     </ul>
> 
> 2. It can output a single error
> 
>     Sorry, you request has failed because the
information could not  be 
> obtained at this time.
> 
> 3. It can output a single error message with an error
code
> 
>     Sorry, your request has failed because:
>      (  )
> 
> 
> The question is, should these three different forms be
one, two or  
> three different templates...?
> 
> Of course, if it is less then three templates, I would
need to place  
> some logic in the template to output the right thing.
> 
> What is the generally accepted 'best practice' in this
situation?
> 
> Thank you.

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )