Re: [PHP Template] Re: if statements
[email protected] (Monte Ohrt)
| Newsgroups | php.template |
|---|---|
| Organization | ispi |
| Message-ID | <[email protected]> |
Tobias Ratschiller wrote:
>
> > Not if the single match needs to be shown in red, for example, or have
> > some other formatting? Since now we're talking about formatting, that
> > belongs in the designer domain.
>
> That's true again. Okay, let me rephrase that: some compromise is needed -
> either you have application logic in the template, or layout in the code.
> So, I'm for if-constructs, and maybe other constructs, in the template as
> long as they don't slow down parsing considerably.
>
> -Tobias
I vote we allow if-constructs in the template for the designers. This
will cover 99% of thier needs. For other special cases, you can just
imbed php code in the template and be sure there is an eval() done on it
at the end. Maybe we can turn on/off the default behavior of eval() on
the template in the php.ini file, and also selectively turn it on/off in
the template itself.
{eval: on}
{if: var = 1}
<!-- html code here -->
{else:}
<!-- other html code here -->
{/if}
<? echo hey; ?>