An example of a template using sectionelse follows:
{section name=book loop=$titles}
{$titles[book]}
{sectionelse}
No entries matching your query were found.
{/section}
Note that sectionelse does not use a closing bracket; rather, it is embedded within
section, much like an elseif is embedded within an if function.
Statements
Smarty offers several statements to perform special tasks. This section introduces
several of these statements.
The include Statement
The include statement operates much like the statement of the same name found in
the PHP distribution, except that it is to be used solely for including other templates into
the current template. For example, suppose you want to include two files, header.tpl
and footer.tpl, into the Smarty template:
{include file="/usr/local/lib/book/19/header.tpl"}
{* Execute some other Smarty statements here. *}
{include file="/usr/local/lib/book/19/footer.tpl"}
This statement also offers two other features. First, you can pass in the optional
assign attribute, which will result in the contents of the included file being assigned
to a variable possessing the name provided to assign:
{include file="/usr/local/lib/book/19/header.tpl" assign="header"}
Rather than outputting the contents of header.tpl, they will be assigned to the
variable $header.
A second feature allows you to pass various attributes to the included file.
Pages:
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571