Re: if statements
[email protected] ("Tobias Ratschiller")
| Newsgroups | php.template |
|---|---|
| Message-ID | <010301bf7800$09dee940$26d0f2c2@tobiasneu> |
> Then the developer would need to explicitly hide one of the sections.
> And what if there is another place on the page where some output will
> depend on where products_total is greater than 5, for example? Another
> effort on part of developer is needed.
>
> So, what are your thoughts? Are 'if' statements good or evil?
For me, if-statements should remain in the application logic. I'm trying to
save my designer from the need to write things like this, after all.
Your example could easily be written as
"Your search found {products_total} {matches}", and the app logic determines
whether it should be "match" or "matches".
-Tobias