Prev | Current Page 560 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

For example,
suppose you want to pass the attribute title="My home page" to the header.tpl file:
CHAPTER 19 ?–  TEMPLAT ING WITH SMARTY 491
{include file="/usr/local/lib/book/19/header.tpl" title="My home page"}
Keep in mind that any attributes passed in this fashion are only available within the
scope of the included file and are not available anywhere else within the template.
?– Note The fetch statement accomplishes the same task as include, embedding a file into a
template, with two differences. First, in addition to retrieving local files, fetch can retrieve files using
the HTTP and FTP protocols. Second, fetch does not have the option of assigning attributes at file
retrieval time.
The insert Statement
The insert statement operates in the same capacity as include, except that it??™s intended
to include data that??™s not meant to be cached. For example, you might use this function
for inserting constantly updated data, such as stock quotes, weather reports, or
anything else that is likely to change over a short period of time. It also accepts several
parameters, one of which is required, and three of which are optional:
name: This required parameter determines the name of the insert function.
assign: This optional parameter can be used when you??™d like the output to be
assigned to a variable rather than sent directly to output.
script: This optional parameter can point to a PHP script that will execute immediately
before the file is included.


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