Wade Preston Shearer wrote:
// Grabbed from Google; the year choices aren't even dynamic.
<select name="day"><?php
for ($i = 1; $i <= 31; $i++) {
echo "<option value=\"$i\">$i</option>\n";
}
?></select>
<select name="month"><?php
for ($i = 1; $i <= 12; $i++) {
$monthname = date(âFâ, mktime(12, 0, 0, $i, 1,
2005));
echo "<option value=\"$i\">$monthname</option>";
}
?></select>
<select name="year"><?php
for ($i = 2005; $i <= 2010; $i++) {
echo "<option value=\"$i\">$i</option>";
}
?></select>
I consider your example breaking the separation of business and
display logic. The front-end should only have display logic; it
shouldn't be performing calculations. You have business logic in your
example. The backend should take care of that and only pass variables
and arrays to the front-end.
The front-end could (should) look like this:
...
I do not see the display of values for day, month, or year as being
business logic. If the calculations do not relate to the domain, I would
expect to see them in the presentation layer, whether that's php or a
different template system. The fact that they are calculations does not
necessarily mean that the code is business logic. In this particular
case, smarty does have a better way of performing *presentation* logic.
Alvaro
_______________________________________________
UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net