After all, the idea is to completely
separate the presentational and logical layers, right? Although that is indeed the idea,
it??™s not always the most practical solution. For example, without allowing for some
sort of iterative logic, how would you output a MySQL result set in a particular format?
480 CHAPTER 19 ?– T EMPLAT I NG WITH SMARTY
You couldn??™t really, at least not without coming up with some rather unwieldy solution.
Recognizing this dilemma, the Smarty developers incorporated some rather simplistic
yet very effective application logic into the engine. This seems to present an ideal
balance because Web site designers are often not programmers (and vice versa).
In this section, you??™ll learn about Smarty??™s impressive presentational features: variable
modifiers, control structures, and statements. First, a brief note regarding comments
is in order.
Comments
Comments are used as necessary throughout the remainder of this chapter. Therefore, it
seems only practical to start by introducing Smarty??™s comment syntax. Comments are
enclosed within the delimiter tags {* and *}, and can consist of a single line or multiple
lines. A valid Smarty comment follows:
{* Some programming note *}
Variable Modifiers
As you learned in Chapter 9, PHP offers an extraordinary number of functions, capable of
manipulating text in just about every which way imaginable.
Pages:
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562