Prev | Current Page 561 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

You might use this if the output file??™s contents
depend specifically on a particular action performed by the script. For example,
you might execute a PHP script that would return certain default stock quotes to
be placed into the noncacheable output.
var: This optional parameter is used to pass in various other parameters of use to
the inserted template. You can pass along numerous parameters in this fashion.
The name parameter is special in the sense that it designates a namespace of sorts
that is specific to the contents intended to be inserted by the insertion statement.
When the insert tag is encountered, Smarty seeks to invoke a user-defined PHP function
named insert_name(), and will pass any variables included with the insert tag
via the var parameters to that function. Whatever output is returned from this function
will then be output in the place of the insert tag.
492 CHAPTER 19 ?–  T EMPLAT I NG WITH SMARTY
Consider a template that looks like this:
width=60}.gif"/>
Once encountered, Smarty will reference any available user-defined PHP function
named insert_banner() and pass it two parameters, namely height and width.
The literal Statement
The literal statement signals to Smarty that any data embedded within its tags
should be output as is, without interpretation. It??™s most commonly used to embed
JavaScript and CSS (cascading style sheets) into the template without worrying about
clashing with Smarty??™s assigned delimiter (curly brackets by default).


Pages:
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573