more patches from Peter: more linking and improvement of examples. thanks :)

This commit is contained in:
nlopess
2005-05-25 19:13:20 +00:00
parent a35971406b
commit b84a9d2d46
54 changed files with 838 additions and 515 deletions

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.capture">
<title>capture</title>
<title>{capture}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -37,13 +37,13 @@
</tgroup>
</informaltable>
<para>
capture is used to collect the output of the template into a
{capture} is used to collect the output of the template into a
variable instead of displaying it. Any content between {capture
name="foo"} and {/capture} is collected into the variable specified
in the name attribute. The captured content can be used in the
template from the special variable <link
linkend="language.variables.smarty.capture">$smarty.capture.foo</link>
where foo is the value passed in the name attribute. If you do not
where "foo" is the value passed in the name attribute. If you do not
supply a name attribute, then "default" will be used. All {capture}
commands must be paired with {/capture}. You can nest capture commands.
</para>
@@ -58,11 +58,12 @@
<caution>
<para>
Be careful when capturing <link
linkend="language.function.insert"><command>insert</command></link>
linkend="language.function.insert">{insert}</link>
output. If you have
<link linkend="caching">caching</link>
turned on and you have
<command>insert</command> commands that you expect to run
<link linkend="language.function.insert">{insert}</link>
commands that you expect to run
within cached content, do not capture this content.
</para>
</caution>
@@ -75,12 +76,15 @@
{capture name=banner}
{include file="get_banner.tpl"}
{/capture}
{if $smarty.capture.banner ne ""}
{if $smarty.capture.banner ne ''}
<table>
<tr>
<td>
{$smarty.capture.banner}
</td>
</tr>
</table>
{/if}
]]>
</programlisting>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.config.load">
<title>config_load</title>
<title>{config_load}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -64,13 +64,14 @@
</tgroup>
</informaltable>
<para>
This function is used for loading in variables from a
{config_load} is used for loading config
<link linkend="language.config.variables">#variables#</link> from a
configuration file into the template.
See <link linkend="config.files">Config Files</link> for more
info.
</para>
<example>
<title>function config_load</title>
<title>{config_load}</title>
<programlisting>
<![CDATA[
{config_load file="colors.conf"}
@@ -127,8 +128,9 @@
</example>
<para>
See also <link linkend="config.files">Config Files</link>,
See also <link linkend="config.files">Config files</link>,
<link linkend="language.config.variables">Config variables</link>,
<link linkend="variable.config.dir">$config_dir</link>,
<link linkend="api.get.config.vars">get_config_vars()</link>
and
<link linkend="api.config.load">config_load()</link>.

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.foreach">
<title>foreach,foreachelse</title>
<title>{foreach},{foreachelse}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -56,8 +56,8 @@
<emphasis>{foreach}</emphasis> loops are an alternative to
<link
linkend="language.function.section"><emphasis>{section}</emphasis></link>
loops. <emphasis>foreach</emphasis> is used to loop over a single
associative array. The syntax for
loops. <emphasis>{foreach}</emphasis> is used to loop over a
<emphasis role="bold">single associative array</emphasis>. The syntax for
<emphasis>{foreach}</emphasis> is much easier than
<emphasis>{section}</emphasis>, but as a tradeoff it
<emphasis role="bold">can only be used
@@ -74,10 +74,17 @@
values in the <emphasis>from</emphasis> variable.
</para>
<example>
<title>foreach</title>
<title>{foreach} - item</title>
<programlisting role="php">
<![CDATA[
<?php
$arr = array( 1001,1002,1003);
$smarty->assign('custid', $arr);
?>
]]>
</programlisting>
<programlisting>
<![CDATA[
{* this example will print out all the values of the $custid array *}
{foreach from=$custid item=curr_id}
id: {$curr_id}<br />
@@ -97,18 +104,25 @@
</example>
<example>
<title>foreach key</title>
<title>{foreach} - item and key</title>
<programlisting role="php">
<![CDATA[
// The key contains the key for each looped value
// assignment looks like this:
<?php
$smarty->assign("contacts", array(
array("phone" => "1",
"fax" => "2",
"cell" => "3"),
array("phone" => "555-4444",
"fax" => "555-3333",
"cell" => "760-1234"))
);
?>
]]>
</programlisting>
<programlisting>
<![CDATA[
{* The key contains the key for each looped value
assignment looks like this:
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
*}
{foreach name=outer item=contact from=$contacts}
{foreach key=key item=item from=$contact}
{$key}: {$item}<br />
@@ -131,8 +145,28 @@
</screen>
</example>
<example>
<title>{foreach} - database example (eg PEAR or ADODB)</title>
<programlisting role="php">
<![CDATA[
<?php
$sql = 'select contact_id, name, nick from contacts order by contact';
$smarty->assign("contacts", $db->getAssoc($sql));
?>
]]>
</programlisting>
<programlisting>
<![CDATA[
{foreach key=cid item=con from=$contacts}
<a href="contact.php?contact_id={$cid}">{$con.name} - {$con.nick}</a><br />
{/foreach}
]]>
</programlisting>
</example>
<para>
Foreach-loops also have their own variables that handle foreach properties.
{foreach} loops also have their own variables that handle {foreach} properties.
These are indicated like so:
<link linkend="language.variables.smarty.loops">{$smarty.foreach.foreachname.varname}</link>
with
@@ -143,11 +177,8 @@
<sect2 id="foreach.property.iteration">
<title>iteration</title>
<para>
iteration is used to display the current loop iteration.
</para>
<para>
Iteration always starts with 1 and is incremented by one
one each iteration.
iteration is used to display the current loop iteration.Iteration always
starts with 1 and is incremented by one on each iteration.
</para>
</sect2>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.if">
<title>if,elseif,else</title>
<title>{if},{elseif},{else}</title>
<para>
<emphasis>{if}</emphasis> statements in Smarty have much the same flexibility as PHP if
statements, with a few added features for the template engine.

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.include.php">
<title>include_php</title>
<title>{include_php}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.include">
<title>include</title>
<title>{include}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.insert">
<title>insert</title>
<title>{insert}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.ldelim">
<title>ldelim,rdelim</title>
<title>{ldelim},{rdelim}</title>
<para>
ldelim and rdelim are used for escaping template delimiters, in our case
"{" or "}". You can also use <link

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.literal">
<title>literal</title>
<title>{literal}</title>
<para>
{literal} tags allow a block of data to be taken literally. This is typically
used around javascript or stylesheet blocks where curly braces would

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.php">
<title>php</title>
<title>{php}</title>
<para>
{php} tags allow php to be embedded directly into the template. They
will not be escaped, regardless of the <link

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.section">
<title>section,sectionelse</title>
<title>{section},{sectionelse}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -75,7 +75,9 @@
</tgroup>
</informaltable>
<para>
Template sections are used for looping over arrays of data. All
Template sections are used for looping over
<emphasis role="bold">arrays of data</emphasis>
(unlike <link linkend="language.function.foreach">{foreach}</link>). All
<emphasis>{section}</emphasis> tags must be paired with
<emphasis>{/section}</emphasis> tags. Required parameters are
<emphasis>name</emphasis> and <emphasis>loop</emphasis>. The name
@@ -89,13 +91,29 @@
executed when there are no values in the loop variable.
</para>
<example>
<title>section</title>
<title>{section}</title>
<programlisting role="php">
<![CDATA[
<?php
$data = array(1000,1001,1002);
$smarty->assign('custid',$data);
?>
]]>
</programlisting>
<programlisting>
<![CDATA[
{* this example will print out all the values of the $custid array *}
{section name=customer loop=$custid}
id: {$custid[customer]}<br />
{/section}
<hr />
{* print out all the values of the $custid array reversed *}
{section name=foo loop=$custid step=-1}
{$custid[foo]}
{/section}
]]>
</programlisting>
<para>
@@ -106,23 +124,71 @@
id: 1000<br />
id: 1001<br />
id: 1002<br />
<hr />
id: 1002<br />
id: 1001<br />
id: 1000<br />
]]>
</screen>
<para>
Another couple of examples without an assigned array.
</para>
<programlisting>
<![CDATA[
{section name=foo start=10 loop=20 step=2}
{$smarty.section.foo.index}
{/section}
<hr />
{section name=bar loop=21 max=6 step=-2}
{$smarty.section.bar.index}
{/section}
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
10 12 14 16 18
<hr />
20 18 16 14 12 10
]]>
</screen>
</example>
<example>
<title>section loop variable</title>
<title>{section} loop variable</title>
<programlisting role="php">
<![CDATA[
<?php
$id = array(1001,1002,1003);
$smarty->assign('custid',$id);
$fullnames = array('John Smith','Jack Jones','Jane Munson');
$smarty->assign('name',$fullnames);
$addr = array('253 N 45th', '417 Mulberry ln', '5605 apple st');
$smarty->assign('address',$addr);
?>
]]>
</programlisting>
<programlisting>
<![CDATA[
{* the loop variable only determines the number of times to loop.
{*
the loop variable only determines the number of times to loop.
you can access any variable from the template within the section.
This example assumes that $custid, $name and $address are all
arrays containing the same number of values *}
arrays containing the same number of values
*}
{section name=customer loop=$custid}
<p>
id: {$custid[customer]}<br />
name: {$name[customer]}<br />
address: {$address[customer]}<br />
<p>
address: {$address[customer]}
</p>
{/section}
]]>
</programlisting>
@@ -131,33 +197,39 @@
</para>
<screen>
<![CDATA[
<p>
id: 1000<br />
name: John Smith<br />
address: 253 N 45th<br />
address: 253 N 45th
</p>
<p>
id: 1001<br />
name: Jack Jones<br />
address: 417 Mulberry ln<br />
address: 417 Mulberry ln
</p>
<p>
id: 1002<br />
name: Jane Munson<br />
address: 5605 apple st<br />
<p>
address: 5605 apple st
</p>
]]>
</screen>
</example>
<example>
<title>section names</title>
<title>{section} naming</title>
<programlisting>
<![CDATA[
{* the name of the section can be anything you like,
and it is used to reference the data within the section *}
{section name=mydata loop=$custid}
id: {$custid[mydata]}<br />
name: {$name[mydata]}<br />
address: {$address[mydata]}<br />
{*
the name of the section can be anything you like,
as it is used to reference the data within the section
*}
{section name=anything loop=$custid}
<p>
id: {$custid[anything]}<br />
name: {$name[anything]}<br />
address: {$address[anything]}
</p>
{/section}
]]>
</programlisting>
@@ -165,20 +237,52 @@
<example>
<title>nested sections</title>
<programlisting role="php">
<![CDATA[
<?php
$id = array(1001,1002,1003);
$smarty->assign('custid',$id);
$fullnames = array('John Smith','Jack Jones','Jane Munson');
$smarty->assign('name',$fullnames);
$addr = array('253 N 45th', '417 Mulberry ln', '5605 apple st');
$smarty->assign('address',$addr);
$types = array(
array( 'home phone', 'cell phone', 'e-mail'),
array( 'home phone', 'web'),
array( 'cell phone')
);
$smarty->assign('contact_type', $types);
$info = array(
array('555-555-5555', '666-555-5555', 'john@myexample.com'),
array( '123-456-4', 'www.example.com'),
array( '0457878')
);
$smarty->assign('contact_info', $info);
?>
]]>
</programlisting>
<programlisting>
<![CDATA[
{* sections can be nested as deep as you like. With nested sections,
{*
sections can be nested as deep as you like. With nested sections,
you can access complex data structures, such as multi-dimensional
arrays. In this example, $contact_type[customer] is an array of
contact types for the current customer. *}
contact types for the current customer.
*}
{section name=customer loop=$custid}
<hr>
id: {$custid[customer]}<br />
name: {$name[customer]}<br />
address: {$address[customer]}<br />
{section name=contact loop=$contact_type[customer]}
{$contact_type[customer][contact]}: {$contact_info[customer][contact]}<br />
{/section}
<p>
{/section}
]]>
</programlisting>
@@ -187,42 +291,62 @@
</para>
<screen>
<![CDATA[
<hr>
id: 1000<br />
name: John Smith<br />
address: 253 N 45th<br />
home phone: 555-555-5555<br />
cell phone: 555-555-5555<br />
cell phone: 666-555-5555<br />
e-mail: john@myexample.com<br />
<p>
<hr>
id: 1001<br />
name: Jack Jones<br />
address: 417 Mulberry ln<br />
home phone: 555-555-5555<br />
cell phone: 555-555-5555<br />
e-mail: jack@myexample.com<br />
<p>
home phone: 123-456-4<br />
web: www.example.com<br />
<hr>
id: 1002<br />
name: Jane Munson<br />
address: 5605 apple st<br />
home phone: 555-555-5555<br />
cell phone: 555-555-5555<br />
e-mail: jane@myexample.com<br />
<p>
cell phone: 0457878<br />
]]>
</screen>
</example>
<example>
<title>sections and associative arrays</title>
<programlisting role="php">
<![CDATA[
<?php
$data = array(
array('name' => 'John Smith', 'home' => '555-555-5555',
'cell' => '666-555-5555', 'email' => 'john@myexample.com'),
array('name' => 'Jack Jones', 'home' => '777-555-5555',
'cell' => '888-555-5555', 'email' => 'jack@myexample.com'),
array('name' => 'Jane Munson', 'home' => '000-555-5555',
'cell' => '123456', 'email' => 'jane@myexample.com')
);
$smarty->assign('contacts',$data);
?>
]]>
</programlisting>
<programlisting>
<![CDATA[
{* This is an example of printing an associative array
of data within a section *}
{*
This is an example of printing an associative array
of data within a section
*}
{section name=customer loop=$contacts}
<p>
name: {$contacts[customer].name}<br />
home: {$contacts[customer].home}<br />
cell: {$contacts[customer].cell}<br />
e-mail: {$contacts[customer].email}<p>
e-mail: {$contacts[customer].email}
</p>
{/section}
]]>
</programlisting>
@@ -231,24 +355,62 @@
</para>
<screen>
<![CDATA[
<p>
name: John Smith<br />
home: 555-555-5555<br />
cell: 555-555-5555<br />
e-mail: john@myexample.com<p>
cell: 666-555-5555<br />
e-mail: john@myexample.com
</p>
<p>
name: Jack Jones<br />
home phone: 555-555-5555<br />
cell phone: 555-555-5555<br />
e-mail: jack@myexample.com<p>
home phone: 777-555-5555<br />
cell phone: 888-555-5555<br />
e-mail: jack@myexample.com
</p>
<p>
name: Jane Munson<br />
home phone: 555-555-5555<br />
cell phone: 555-555-5555<br />
e-mail: jane@myexample.com<p>
home phone: 000-555-5555<br />
cell phone: 123456<br />
e-mail: jane@myexample.com
</p>
]]>
</screen>
<para>Database example (eg using Pear or Adodb)</para>
<programlisting role="php">
<![CDATA[
<?php
$sql = 'select id, name, home, cell, email from contacts';
$smarty->assign('contacts',$db->getAll($sql) );
?>
]]>
</programlisting>
<programlisting>
<![CDATA[
{*
output database result in a table
*}
<table>
<tr><th>&nbsp;</th><th>Name></th><th>Home</th><th>Cell</th><th>Email</th></tr>
{section name=co loop=$contacts}
<tr>
<td><a href="view.php?id={$contacts[customer].id}">view<a></td>
<td>{$contacts[co].name}</td>
<td>{$contacts[co].home}</td>
<td>{$contacts[co].cell}</td>
<td>{$contacts[co].email}</td>
<tr>
{/section}
</table>
]]>
</programlisting>
</example>
<example>
<title>sectionelse</title>
<title>{sectionelse}</title>
<programlisting>
<![CDATA[
{* sectionelse will execute if there are no $custid values *}
@@ -268,16 +430,15 @@
<note>
<para>
As of Smarty 1.5.0, the syntax for section property variables has
been changed from {%sectionname.varname%} to
changed from {%sectionname.varname%} to
{$smarty.section.sectionname.varname}. The old syntax is still
supported, but you will only see reference to the new syntax in the
manual examples.
supported, but you will only see examples of the new syntax.
</para>
</note>
<sect2 id="section.property.index">
<title>index</title>
<para>
index is used to display the current loop index, starting with zero
index is used to display the current array index, starting with zero
(or the start attribute if given), and incrementing by one (or by
the step attribute if given.)
</para>
@@ -287,13 +448,15 @@
If the step and start section properties are not
modified, then this works the same as the <link
linkend="section.property.iteration">iteration</link> section
property, except it starts on 0 instead of 1.
property, except it starts at 0 instead of 1.
</para>
</note>
<example>
<title>section property index</title>
<title>{section} property index</title>
<programlisting>
<![CDATA[
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
{section name=customer loop=$custid}
{$smarty.section.customer.index} id: {$custid[customer]}<br />
{/section}
@@ -311,40 +474,16 @@
</screen>
</example>
</sect2>
<sect2 id="section.property.index.prev">
<title>index_prev</title>
<para>
index_prev is used to display the previous loop index.
on the first loop, this is set to -1.
</para>
<example>
<title>section property index_prev</title>
<programlisting>
<![CDATA[
{section name=customer loop=$custid}
{$smarty.section.customer.index} id: {$custid[customer]}<br />
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
{if $custid[customer.index_prev] ne $custid[customer.index]}
The customer id changed<br />
{/if}
{/section}
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
0 id: 1000<br />
The customer id changed<br />
1 id: 1001<br />
The customer id changed<br />
2 id: 1002<br />
The customer id changed<br />
]]>
</screen>
</example>
</sect2>
<sect2 id="section.property.index.next">
<title>index_next</title>
<para>
@@ -352,34 +491,56 @@
loop, this is still one more than the current index (respecting the
setting of the step attribute, if given.)
</para>
<example>
<title>section property index_next</title>
<title>{section} property index_next and index_prev</title>
<programlisting role="php">
<![CDATA[
<?php
$data = array(1001,1002,1003,1004,1005);
$smarty->assign('custid',$data);
?>
]]>
</programlisting>
<programlisting>
<![CDATA[
{section name=customer loop=$custid}
{$smarty.section.customer.index} id: {$custid[customer]}<br />
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
{if $custid[customer.index_next] ne $custid[customer.index]}
The customer id will change<br />
{/if}
{* FYI, $custid[cus.index] and $custid[cus] are identical in meaning *}
<table>
<tr>
<th>index</th><th>id</th>
<th>index_prev</th><th>prev id</th>
<th>index_next</th><th>next id</th>
</tr>
{section name=cus loop=$custid}
<tr>
<td>{$smarty.section.cus.index}</td><td>{$custid[cus]}</td>
<td>{$smarty.section.cus.index_prev}</td><td>{$custid[cus.index_prev]}</td>
<td>{$smarty.section.cus.index_next}</td><td>{$custid[cus.index_next]}</td>
</tr>
{/section}
</table>
]]>
</programlisting>
<para>
The above example will output:
The above example will output a table containing the following:
</para>
<screen>
<![CDATA[
0 id: 1000<br />
The customer id will change<br />
1 id: 1001<br />
The customer id will change<br />
2 id: 1002<br />
The customer id will change<br />
index id index_prev previd index_next nextid
0 1001 -1 1 1002
1 1002 0 1001 2 1003
2 1003 1 1002 3 1004
3 1004 2 1003 4 1005
4 1005 3 1004 5
]]>
</screen>
</example>
</sect2>
<sect2 id="section.property.iteration">
<title>iteration</title>
<para>
@@ -395,16 +556,24 @@
</para>
</note>
<example>
<title>section property iteration</title>
<title>{section} property iteration</title>
<programlisting role="php">
<![CDATA[
<?php
// array of 3000 to 3015
$id = range(3000,3015);
$smarty->assign('custid',$id);
?>
]]>
</programlisting>
<programlisting>
<![CDATA[
{section name=customer loop=$custid start=5 step=2}
current loop iteration: {$smarty.section.customer.iteration}<br />
{$smarty.section.customer.index} id: {$custid[customer]}<br />
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
{if $custid[customer.index_next] ne $custid[customer.index]}
The customer id will change<br />
{/if}
{section name=cu loop=$custid start=5 step=2}
iteration={$smarty.section.cu.iteration}
index={$smarty.section.cu.index}
id={$custid[cu]}<br />
{/section}
]]>
</programlisting>
@@ -413,95 +582,91 @@
</para>
<screen>
<![CDATA[
current loop iteration: 1
5 id: 1000<br />
The customer id will change<br />
current loop iteration: 2
7 id: 1001<br />
The customer id will change<br />
current loop iteration: 3
9 id: 1002<br />
The customer id will change<br />
iteration=1 index=5 id=3005<br />
iteration=2 index=7 id=3007<br />
iteration=3 index=9 id=3009<br />
iteration=4 index=11 id=3011<br />
iteration=5 index=13 id=3013<br />
iteration=6 index=15 id=3015<br />
]]>
</screen>
</example>
<para>
This example uses the iteration property to
output a table header block every five rows
(uses <link linkend="language.function.if">{if}</link>
with the mod operator).
</para>
<programlisting>
<![CDATA[
<table>
{section name=co loop=$contacts}
{if $smarty.section.co.iteration % 5 == 1}
<tr><th>&nbsp;</th><th>Name></th><th>Home</th><th>Cell</th><th>Email</th></tr>
{/if}
<tr>
<td><a href="view.php?id={$contacts[co].id}">view<a></td>
<td>{$contacts[co].name}</td>
<td>{$contacts[co].home}</td>
<td>{$contacts[co].cell}</td>
<td>{$contacts[co].email}</td>
<tr>
{/section}
</table>
]]>
</programlisting>
</example>
</sect2>
<sect2 id="section.property.first">
<title>first</title>
<para>
first is set to true if the current section iteration is the first
first is set to true if the current section <link
linkend="section.property.iteration">iteration</link> is the first
one.
</para>
<example>
<title>section property first</title>
<programlisting>
<![CDATA[
{section name=customer loop=$custid}
{if $smarty.section.customer.first}
<table>
{/if}
<tr><td>{$smarty.section.customer.index} id:
{$custid[customer]}</td></tr>
{if $smarty.section.customer.last}
</table>
{/if}
{/section}
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
<table>
<tr><td>0 id: 1000</td></tr>
<tr><td>1 id: 1001</td></tr>
<tr><td>2 id: 1002</td></tr>
</table>
]]>
</screen>
</example>
</sect2>
<sect2 id="section.property.last">
<title>last</title>
<para>
last is set to true if the current section iteration is the last
last is set to true if the current section <link
linkend="section.property.iteration">iteration</link> is the last
one.
</para>
<example>
<title>section property last</title>
<title>{section} property first and last</title>
<para>
This example loops the $customers array;
outputs a header block on the first iteration and
on the last outputs the footer block
(uses section <link linkend="section.property.total">total</link> property)
</para>
<programlisting>
<![CDATA[
{section name=customer loop=$custid}
{section name=customer loop=$customers}
{if $smarty.section.customer.first}
<table>
<tr><th>id</th><th>customer</th></tr>
{/if}
<tr><td>{$smarty.section.customer.index} id:
{$custid[customer]}</td></tr>
<tr>
<td>{$customers[customer].id}}</td>
<td>{$customers[customer].name}</td>
</tr>
{if $smarty.section.customer.last}
<tr><td></td><td>{$smarty.section.customer.total} customers</td></tr>
</table>
{/if}
{/section}
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
<table>
<tr><td>0 id: 1000</td></tr>
<tr><td>1 id: 1001</td></tr>
<tr><td>2 id: 1002</td></tr>
</table>
]]>
</screen>
</example>
</sect2>
<sect2 id="section.property.rownum">
<title>rownum</title>
<para>
@@ -510,26 +675,6 @@
linkend="section.property.iteration">iteration</link>, they work
identically.
</para>
<example>
<title>section property rownum</title>
<programlisting>
<![CDATA[
{section name=customer loop=$custid}
{$smarty.section.customer.rownum} id: {$custid[customer]}<br />
{/section}
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
1 id: 1000<br />
2 id: 1001<br />
3 id: 1002<br />
]]>
</screen>
</example>
</sect2>
<sect2 id="section.property.loop">
<title>loop</title>
@@ -538,7 +683,7 @@
looped. This can be used inside or after the section.
</para>
<example>
<title>section property index</title>
<title>{section} property index</title>
<programlisting>
<![CDATA[
{section name=customer loop=$custid}
@@ -567,15 +712,17 @@
<para>
<emphasis>show</emphasis> is used as a parameter to section.
<emphasis>show</emphasis> is a boolean value, true or false. If
false, the section will not be displayed. If there is a sectionelse
false, the section will not be displayed. If there is a {sectionelse}
present, that will be alternately displayed.
</para>
<example>
<title>section attribute show</title>
<title>{section} attribute show</title>
<programlisting>
<![CDATA[
{* $show_customer_info may have been passed from the PHP
application, to regulate whether or not this section shows *}
{*
$show_customer_info (true/false) may have been passed from the PHP
application, to regulate whether or not this section shows
*}
{section name=customer loop=$custid show=$show_customer_info}
{$smarty.section.customer.rownum} id: {$custid[customer]}<br />
{/section}
@@ -608,7 +755,7 @@
will loop. This can be used inside or after the section.
</para>
<example>
<title>section property total</title>
<title>{section} property total</title>
<programlisting>
<![CDATA[
{section name=customer loop=$custid step=2}
@@ -624,8 +771,8 @@
<screen>
<![CDATA[
0 id: 1000<br />
2 id: 1001<br />
4 id: 1002<br />
2 id: 1002<br />
4 id: 1004<br />
There were 3 customers shown above.
]]>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.strip">
<title>strip</title>
<title>{strip}</title>
<para>
Many times web designers run into the issue where white space and
carriage returns affect the output of the rendered HTML (browser
@@ -20,8 +20,8 @@
<title>Technical Note</title>
<para>
{strip}{/strip} does not affect the contents of template variables.
See the <link linkend="language.modifier.strip">strip modifier
function</link>.
See the
<link linkend="language.modifier.strip">strip modifier</link>.
</para>
</note>
<example>
@@ -47,7 +47,7 @@
</para>
<screen>
<![CDATA[
<table border=0><tr><td><A HREF="http://my.example.com"><font color="red">This is a test</font></A></td></tr></table>
<table border=0><tr><td><A HREF="http://w... snipped...</td></tr></table>
]]>
</screen>
</example>
@@ -57,6 +57,10 @@
If you have plain text at the beginning or end of any line,
they will be run together, and may not be desired results.
</para>
<para>
See also
<link linkend="language.modifier.strip">strip modifier</link>
</para>
</sect1>
<!-- Keep this comment at the end of the file
@@ -79,3 +83,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -11,15 +11,18 @@
<title>combining modifiers</title>
<programlisting role="php">
<![CDATA[
index.php:
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Smokers are Productive, but Death Cuts Efficiency.');
$smarty->display('index.tpl');
?>
index.tpl:
]]>
</programlisting>
<para>
where template is:
</para>
<programlisting>
<![CDATA[
{$articleTitle}
{$articleTitle|upper|spacify}
{$articleTitle|lower|spacify|truncate}

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.assign">
<title>assign</title>
<title>{assign}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.counter">
<title>counter</title>
<title>{counter}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -65,7 +65,7 @@
</tgroup>
</informaltable>
<para>
counter is used to print out a count. counter will remember the
{counter} is used to print out a count. {counter} will remember the
count on each iteration. You can adjust the number, the interval
and the direction of the count, as well as determine whether or not
to print the value. You can run multiple counters concurrently by

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.cycle">
<title>cycle</title>
<title>{cycle}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -68,12 +68,12 @@
</tgroup>
</informaltable>
<para>
Cycle is used to cycle though a set of values. This makes it easy
to alternate between two or more colors in a table, or cycle
{cycle} is used to cycle though a set of values. This makes it easy
to alternate for example between two or more colors in a table, or cycle
through an array of values.
</para>
<para>
You can cycle through more than one set of values in your template
You can {cycle} through more than one set of values in your template
by supplying a name attribute. Give each set of values a unique
name.
</para>
@@ -84,11 +84,11 @@
</para>
<para>
The advance attribute is used to repeat a value. When set to false,
the next call to cycle will print the same value.
the next call to {cycle} will print the same value.
</para>
<para>
If you supply the special "assign" attribute, the output of the
cycle function will be assigned to this template variable instead of
cycle function will be assigned to a template variable instead of
being output to the template.
</para>
<example>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.debug">
<title>debug</title>
<title>{debug}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.eval">
<title>eval</title>
<title>{eval}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -38,13 +38,13 @@
</tgroup>
</informaltable>
<para>
eval is used to evaluate a variable as a template. This can be used
{eval} is used to evaluate a variable as a template. This can be used
for things like embedding template tags/variables into variables or
tags/variables into config file variables.
</para>
<para>
If you supply the special "assign" attribute, the output of the
eval function will be assigned to this template variable instead of
{eval} function will be assigned to this template variable instead of
being output to the template.
</para>
<note>
@@ -59,12 +59,14 @@
<title>Technical Note</title>
<para>
Evaluated variables are compiled on every invocation, the compiled
versions are not saved! However if you have caching enabled, the
versions are not saved! However if you have
<link linkend="caching">caching</link>
enabled, the
output will be cached with the rest of the template.
</para>
</note>
<example>
<title>eval</title>
<title>{eval}</title>
<programlisting>
<![CDATA[
setup.conf
@@ -96,7 +98,6 @@
</para>
<screen>
<![CDATA[
This is the contents of foo.
Welcome to Foobar Pub & Grill's home page!
You must supply a <strong>city</strong>.

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.fetch">
<title>fetch</title>
<title>{fetch}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.html.checkboxes">
<title>html_checkboxes</title>
<title>{html_checkboxes}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -72,7 +72,9 @@
</tgroup>
</informaltable>
<para>
html_checkboxes is a custom function that creates an html checkbox
{html_checkboxes} is a
<link linkend="language.custom.functions">custom function</link>
that creates an html checkbox
group with provided data. It takes care of which item(s) are
selected by default as well. Required attributes are values and
output, unless you use options instead. All output is XHTML
@@ -83,30 +85,29 @@
name/value-pairs inside each of the created &lt;input&gt;-tags.
</para>
<example>
<title>html_checkboxes</title>
<para>
where PHP code is:
</para>
<title>{html_checkboxes}</title>
<programlisting role="php">
<![CDATA[
<?php
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
$smarty->assign('cust_names', array('Joe Schmoe','Jack Smith','Jane Johnson','Charlie Brown'));
$smarty->assign('cust_names', array(
'Joe Schmoe',
'Jack Smith',
'Jane Johnson',
'Charlie Brown'));
$smarty->assign('customer_id', 1001);
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
and index.tpl is:
where template is
</para>
<programlisting>
<![CDATA[
{html_checkboxes name="id" values=$cust_ids selected=$customer_id output=$cust_names separator="<br />"}
{html_checkboxes name="id" values=$cust_ids output=$cust_names
selected=$customer_id separator="<br />"}
]]>
</programlisting>
<para>
@@ -116,20 +117,18 @@ $smarty->display('index.tpl');
<![CDATA[
<?php
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->assign('cust_checkboxes', array(
1000 => 'Joe Schmoe',
1001 => 'Jack Smith',
1002 => 'Jane Johnson',
1003 => 'Charlie Brown'));
$smarty->assign('customer_id', 1001);
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
and index.tpl is:
and the template is
</para>
<programlisting>
<![CDATA[
@@ -142,12 +141,42 @@ $smarty->display('index.tpl');
<screen>
<![CDATA[
<label><input type="checkbox" name="id[]" value="1000" />Joe Schmoe</label><br />
<label><input type="checkbox" name="id[]" value="1001" checked="checked" />Jack Smith</label><br />
<label><input type="checkbox" name="id[]" value="1001" checked="checked" />Jack Smith</label>
<br />
<label><input type="checkbox" name="id[]" value="1002" />Jane Johnson</label><br />
<label><input type="checkbox" name="id[]" value="1003" />Charlie Brown</label><br />
]]>
</screen>
</example>
<example>
<title>
Database example (eg PEAR or ADODB):
</title>
<programlisting role="php">
<![CDATA[
<?php
$sql = 'select type_id, types from types order by type';
$smarty->assign('types',$db->getAssoc($sql));
$sql = 'select * from contacts where contact_id=12';
$smarty->assign('contact',$db->getRow($sql));
?>
]]>
</programlisting>
<programlisting>
<![CDATA[
{html_checkboxes name="type" options=$types selected=$contact.type_id separator="<br />"}
]]>
</programlisting>
</example>
<para>
See also
<link linkend="language.function.html.radios">{html_radios}</link>
and
<link linkend="language.function.html.options">{html_options}</link>
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
@@ -169,3 +198,6 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.html.image">
<title>html_image</title>
<title>{html_image}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -65,58 +65,52 @@
</tgroup>
</informaltable>
<para>
html_image is a custom function that generates an HTML tag for an
{html_image} is a
<link linkend="language.custom.functions">custom function</link>
that generates an HTML tag for an
image. The height and width are automatically calculated from the
image file if none are supplied.
</para>
<para>
basedir is the base directory that relative image paths are based
from. If not given, the web server document root (env variable
DOCUMENT_ROOT) is used as the base. If security is enabled, the
from. If not given, the web server document root (
<link linkend="language.variables.smarty">env</link>
variable DOCUMENT_ROOT) is used as the base. If
<link linkend="variable.security">$security</link>
is enabled, the
path to the image must be within a secure directory.
</para>
<para>
<parameter>href</parameter> is the href value to link the image to. If link is supplied, an
&lt;a href="LINKVALUE"&gt;&lt;a&gt; tag is put around the image tag.
&lt;a href="LINKVALUE"&gt;&lt;a&gt; tag is placed around the image tag.
</para>
<para>
All parameters that are not in the list above are printed as
name/value-pairs inside the created &lt;img&gt;-tag.
name/value-pairs inside the created &lt;img&gt; tag.
</para>
<note>
<title>Technical Note</title>
<para>
html_image requires a hit to the disk to read the image and
{html_image} requires a hit to the disk to read the image and
calculate the height and width. If you don't use template
caching, it is generally better to avoid html_image and leave
<link linkend="caching">caching</link>,
it is generally better to avoid {html_image} and leave
image tags static for optimal performance.
</para>
</note>
<example>
<title>html_image example</title>
<programlisting role="php">
<![CDATA[
<?php
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
where index.tpl is:
</para>
<programlisting>
<![CDATA[
where index.tpl is:
-------------------
{html_image file="pumpkin.jpg"}
{html_image file="/path/from/docroot/pumpkin.jpg"}
{html_image file="../path/relative/to/currdir/pumpkin.jpg"}
]]>
</programlisting>
<para>
a possible output would be:
possible output would be:
</para>
<screen>
<![CDATA[

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.html.options">
<title>html_options</title>
<title>{html_options}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -58,90 +58,90 @@
</tgroup>
</informaltable>
<para>
html_options is a custom function that creates html option group
{html_options} is a
<link linkend="language.custom.functions">custom function</link>
that creates html &lt;select&gt;&lt;option&gt; group
with provided data. It takes care of which item(s) are selected by
default as well. Required attributes are values and output, unless
you use options instead.
</para>
<para>
If a given value is an array, it will treat it as an html OPTGROUP,
and display the groups. Recursion is supported with OPTGROUP. All
If a given value is an array, it will treat it as an html &lt;optgroup&gt;,
and display the groups. Recursion is supported with &lt;optgroup&gt;. All
output is XHTML compatible.
</para>
<para>
If the optional <emphasis>name</emphasis> attribute is given, the
&lt;select name="groupname"&gt;&lt;/select&gt; tags will enclose
the option list. Otherwise only the option list is generated.
the option list. Otherwise only the &lt;option&gt; list is generated.
</para>
<para>
All parameters that are not in the list above are printed as
name/value-pairs inside the &lt;select&gt;-tag. They are ignored if
name/value-pairs inside the &lt;select&gt; tag. They are ignored if
the optional <emphasis>name</emphasis> is not given.
</para>
<example>
<title>html_options : Example 1</title>
<programlisting>
<title>{html_options}</title>
<para>
<emphasis role="bold">Example 2:</emphasis>
</para>
<programlisting role="php">
<![CDATA[
index.php:
----------
<?php
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
$smarty->assign('cust_names', array('Joe Schmoe','Jack Smith','Jane
Johnson','Charlie Brown'));
$smarty->assign('cust_names', array(
'Joe Schmoe',
'Jack Smith',
'Jane Johnson',
'Charlie Brown'));
$smarty->assign('customer_id', 1001);
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[
<select name=customer_id>
{html_options values=$cust_ids selected=$customer_id output=$cust_names}
{html_options values=$cust_ids output=$cust_names selected=$customer_id}
</select>
]]>
</programlisting>
<para>
Example 2
<emphasis role="bold">Example 2:</emphasis>
</para>
<programlisting>
<programlisting role="php">
<![CDATA[
index.php:
----------
<?php
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->assign('cust_options', array(
1001 => 'Joe Schmoe',
1002 => 'Jack Smith',
1003 => 'Jane Johnson',
1004 => 'Charlie Brown'));
$smarty->assign('customer_id', 1001);
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
Where index.tpl is:
where template is:
</para>
<programlisting>
<![CDATA[
<select name=customer_id>
{html_options options=$cust_options selected=$customer_id}
</select>
]]>
</programlisting>
<para>
Both examples will output:
Both the above examples will output:
</para>
<screen>
<![CDATA[
<select name=customer_id>
<option label="Joe Schmoe" value="1000">Joe Schmoe</option>
<option label="Jack Smith" value="1001" selected="selected">Jack Smith</option>
@@ -152,6 +152,38 @@
]]>
</screen>
</example>
<example>
<title>{html_options} - Database example (eg PEAR or ADODB):</title>
<programlisting role="php">
<![CDATA[
<?php
$sql = 'select type_id, types from types order by type';
$smarty->assign('types',$db->getAssoc($sql));
$sql = 'select * from contacts where contact_id=12';
$smarty->assign('contact',$db->getRow($sql));
?>
]]>
</programlisting>
<para>
where the template is:
</para>
<programlisting>
<![CDATA[
<select name="type_id">
{html_options name="type" options=$types selected=$contact.type_id}
</select>
]]>
</programlisting>
</example>
<para>
See also
<link linkend="language.function.html.checkboxes">{html_checkboxes}</link>
and
<link linkend="language.function.html.radios">{html_radios}</link>
</para>
</sect1>
<!-- Keep this comment at the end of the file

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.html.radios">
<title>html_radios</title>
<title>{html_radios}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -65,7 +65,9 @@
</tgroup>
</informaltable>
<para>
html_radios is a custom function that creates html radio button
{html_radios} is a
<link linkend="language.custom.functions">custom function</link>
that creates html radio button
group with provided data. It takes care of which item is selected
by default as well. Required attributes are values and output,
unless you use options instead. All output is XHTML compatible.
@@ -76,46 +78,46 @@
</para>
<example>
<title>html_radios : Example 1</title>
<programlisting>
<title>{html_radios} : Example 1</title>
<programlisting role="php">
<![CDATA[
index.php:
----------
<?php
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
$smarty->assign('cust_names', array('Joe Schmoe','Jack Smith','Jane
Johnson','Charlie Brown'));
$smarty->assign('cust_names', array(
'Joe Schmoe',
'Jack Smith',
'Jane Johnson',
'Charlie Brown'));
$smarty->assign('customer_id', 1001);
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[
{html_radios name="id" values=$cust_ids selected=$customer_id output=$cust_names separator="<br />"}
{html_radios name="id" values=$cust_ids output=$cust_names
selected=$customer_id separator="<br />"}
]]>
</programlisting>
<para>
Example 2 :
</para>
<programlisting>
</example>
<example>
<title>{html_radios} : Example 2</title>
<programlisting role="php">
<![CDATA[
index.php:
----------
<?php
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->assign('cust_radios', array(
1000 => 'Joe Schmoe',
1001 => 'Jack Smith',
1002 => 'Jane Johnson',
1003 => 'Charlie Brown'));
$smarty->assign('customer_id', 1001);
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
@@ -131,13 +133,48 @@
</para>
<screen>
<![CDATA[
<label for="id_1000"><input type="radio" name="id" value="1000" id="id_1000" />Joe Schmoe</label><br />
<label for="id_1001"><input type="radio" name="id" value="1001" id="id_1001" checked="checked" />Jack Smith</label><br />
<label for="id_1002"><input type="radio" name="id" value="1002" id="id_1002" />Jane Johnson</label><br />
<label for="id_1003"><input type="radio" name="id" value="1003" id="id_1003" />Charlie Brown</label><br />
<label for="id_1000"><input type="radio" name="id" value="1000" id="id_1000" />Joe
Schmoe</label><br />
<label for="id_1001"><input type="radio" name="id" value="1001" id="id_1001"
checked="checked" />Jack
Smith</label><br />
<label for="id_1002"><input type="radio" name="id" value="1002" id="id_1002" />Jane
Johnson</label><br />
<label for="id_1003"><input type="radio" name="id" value="1003" id="id_1003" />Charlie
Brown</label><br />
]]>
</screen>
</example>
<example>
<title>{html_radios}- Database example (eg PEAR or ADODB):</title>
<programlisting role="php">
<![CDATA[
<?php
$sql = 'select type_id, types from types order by type';
$smarty->assign('types',$db->getAssoc($sql));
$sql = 'select * from contacts where contact_id=12';
$smarty->assign('contact',$db->getRow($sql));
?>
]]>
</programlisting>
<para>
and the template:
</para>
<programlisting>
<![CDATA[
{html_radios name="type" options=$types selected=$contact.type_id separator="<br />"}
]]>
</programlisting>
</example>
<para>
See also
<link linkend="language.function.html.checkboxes">{html_checkboxes}</link>
and
<link linkend="language.function.html.options">{html_options}</link>
</para>
</sect1>
<!-- Keep this comment at the end of the file
@@ -160,3 +197,7 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.html.select.date">
<title>html_select_date</title>
<title>{html_select_date}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -222,13 +222,17 @@
</tgroup>
</informaltable>
<para>
{html_select_date} is a custom function that creates date dropdowns
{html_select_date} is a
<link linkend="language.custom.functions">custom function</link>
that creates date dropdowns
for you. It can display any or all of year, month, and day.
</para>
<example>
<title>html_select_date</title>
<title>{html_select_date}</title>
<programlisting>
<![CDATA[
template code:
-------------
{html_select_date}
]]>
</programlisting>
@@ -241,12 +245,7 @@
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
..... snipped .....
<option value="10">October</option>
<option value="11">November</option>
<option value="12" selected="selected">December</option>
@@ -255,31 +254,13 @@
<option value="1">01</option>
<option value="2">02</option>
<option value="3">03</option>
<option value="4">04</option>
<option value="5">05</option>
<option value="6">06</option>
<option value="7">07</option>
<option value="8">08</option>
<option value="9">09</option>
<option value="10">10</option>
..... snipped .....
<option value="11">11</option>
<option value="12">12</option>
<option value="13" selected="selected">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
..... snipped .....
<option value="29">29</option>
<option value="30">30</option>
<option value="31">31</option>
@@ -292,11 +273,12 @@
</example>
<example>
<title>html_select_date</title>
<title>{html_select_date}</title>
<programlisting>
<![CDATA[
{* start and end year can be relative to current year *}
{html_select_date prefix="StartDate" time=$time start_year="-5" end_year="+1" display_days=false}
{html_select_date prefix="StartDate" time=$time start_year="-5"
end_year="+1" display_days=false}
]]>
</programlisting>
<para>
@@ -358,3 +340,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.html.select.time">
<title>html_select_time</title>
<title>{html_select_time}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -133,22 +133,24 @@
</tgroup>
</informaltable>
<para>
{html_select_time} is a custom function that
creates time dropdowns for you. It can display
any or all of hour, minute, second and
meridian.
{html_select_time} is a
<link linkend="language.custom.functions">custom function</link>
that creates time dropdowns for you. It can display
any or all of hour, minute, second and meridian.
</para>
<para>
The time-attribute can have different
formats. It can be a unique timestamp or a
formats. It can be a unique timestamp, a
string of the format YYYYMMDDHHMMSS or a string
that is parseable by php's
<ulink url="&url.php-manual;strtotime">strtotime()</ulink>.
</para>
<example>
<title>html_select_time</title>
<title>{html_select_time}</title>
<programlisting>
<![CDATA[
template code:
--------------
{html_select_time use_24_hours=true}
]]>
</programlisting>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.html.table">
<title>html_table</title>
<title>{html_table}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -117,7 +117,9 @@
</tgroup>
</informaltable>
<para>
<emphasis>html_table</emphasis> is a custom function that dumps an array of
{html_table} is a
<link linkend="language.custom.functions">custom function</link>
that dumps an array of
data into an HTML table. The <emphasis>cols</emphasis> attribute determines
how many columns will be in the table. The <emphasis>table_attr</emphasis>,
<emphasis>tr_attr</emphasis> and <emphasis>td_attr</emphasis> values
@@ -131,6 +133,8 @@
<title>html_table</title>
<programlisting role="php">
<![CDATA[
php code:
---------
<?php
require('Smarty.class.php');
$smarty = new Smarty;
@@ -142,6 +146,8 @@ $smarty->display('index.tpl');
</programlisting>
<programlisting>
<![CDATA[
template code:
--------------
{html_table loop=$data}
{html_table loop=$data cols=4 table_attr='border="0"'}
{html_table loop=$data cols=4 tr_attr=$tr}

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.mailto">
<title>mailto</title>
<title>{mailto}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -91,9 +91,9 @@
</tgroup>
</informaltable>
<para>
mailto automates the creation of mailto links and optionally
{mailto} automates the creation of mailto: links and optionally
encodes them. Encoding e-mails makes it more difficult for
web spiders to pick up e-mail addresses off of your site.
web spiders to lift e-mail addresses off of your site.
</para>
<note>
<title>Technical Note</title>
@@ -103,42 +103,49 @@
</para>
</note>
<example>
<title>mailto</title>
<title>{mailto}</title>
<programlisting>
<![CDATA[
{mailto address="me@example.com"}
<a href="mailto:me@example.com" >me@example.com</a>
{mailto address="me@example.com" text="send me some mail"}
<a href="mailto:me@example.com" >send me some mail</a>
{mailto address="me@example.com" encode="javascript"}
<script type="text/javascript" language="javascript">
eval(unescape('%64%6f% ... snipped ...%61%3e%27%29%3b'))
</script>
{mailto address="me@example.com" encode="hex"}
<a href="mailto:%6d%65.. snipped..3%6f%6d">&#x6d;&..snipped...#x6f;&#x6d;</a>
{mailto address="me@example.com" subject="Hello to you!"}
{mailto address="me@example.com" cc="you@example.com,they@example.com"}
{mailto address="me@example.com" extra='class="email"'}
{mailto address="me@example.com" encode="javascript_charcode"}
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
<a href="mailto:me@example.com" >me@example.com</a>
<a href="mailto:me@example.com" >send me some mail</a>
<script type="text/javascript" language="javascript">eval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%6
9%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%
61%69%6e%2e%63%6f%6d%22%20%3e%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%3c%2f%61%3e
%27%29%3b'))</script>
<a href="mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d" >&#x6d;&#x65;&#x40;&#x64;&#x6f;&#x6d;&#x61;&#x69;&#x6e;&#x2e;&#x63;&#x6f;&#x6d;</a>
<a href="mailto:me@example.com?subject=Hello%20to%20you%21" >me@example.com</a>
{mailto address="me@example.com" cc="you@example.com,they@example.com"}
<a href="mailto:me@example.com?cc=you@example.com%2Cthey@example.com" >me@example.com</a>
{mailto address="me@example.com" extra='class="email"'}
<a href="mailto:me@example.com" class="email">me@example.com</a>
{mailto address="me@example.com" encode="javascript_charcode"}
<script type="text/javascript" language="javascript">
<!--
{document.write(String.fromCharCode(60,97,32,104,114,101,102,61,34,109,97,105,108,116,111,58,109,101,64,101,120,97,109,112,108,101,46,99,111,109,34,32,62,109,101,64,101,120,97,109,112,108,101,46,99,111,109,60,47,97,62))}
{document.write(String.fromCharCode(60,97, ... snipped ....60,47,97,62))}
//-->
</script>
]]>
</screen>
</programlisting>
</example>
<para>
See also
<link linkend="language.modifier.escape">escape</link>,
<link linkend="tips.obfuscating.email">Obfuscating E-mail Addresses</link>
and
<link linkend="language.function.textformat">{textformat}</link>
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
@@ -160,3 +167,4 @@
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.math">
<title>math</title>
<title>{math}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -58,7 +58,7 @@
</tgroup>
</informaltable>
<para>
math allows the template designer to do math equations in the
{math} allows the template designer to do math equations in the
template. Any numeric template variables may be used in the
equations, and the result is printed in place of the tag. The
variables used in the equation are passed as parameters, which can
@@ -75,15 +75,21 @@
<note>
<title>Technical Note</title>
<para>
math is an expensive function in performance due to its use of
the php eval() function. Doing the math in PHP is much more
{math} is an expensive function in performance due to its use of the php
<ulink url="&url.php-manual;eval">eval()</ulink> function. Doing the math in PHP is much
more
efficient, so whenever possible do the math calculations in PHP
and assign the results to the template. Definately avoid
repetitive math function calls, like within section loops.
and <link linkend="api.assign">assign()</link>
the results to the template. Definately avoid
repetitive {math} function calls, eg within
<link linkend="language.function.section">{section}</link> loops.
</para>
</note>
<example>
<title>math</title>
<title>{math}</title>
<para>
<emphasis role="bold">Example a:</emphasis>
</para>
<programlisting>
<![CDATA[
{* $height=4, $width=5 *}
@@ -99,6 +105,9 @@
9
]]>
</screen>
<para>
<emphasis role="bold">Example b:</emphasis>
</para>
<programlisting>
<![CDATA[
{* $row_height = 10, $row_width = 20, #col_div# = 2, assigned in template *}
@@ -117,6 +126,9 @@
100
]]>
</screen>
<para>
<emphasis role="bold">Example c:</emphasis>
</para>
<programlisting>
<![CDATA[
{* you can use parenthesis *}
@@ -132,6 +144,9 @@
6
]]>
</screen>
<para>
<emphasis role="bold">Example d:</emphasis>
</para>
<programlisting>
<![CDATA[
{* you can supply a format parameter in sprintf format *}

View File

@@ -1,28 +1,33 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.popup.init">
<title>popup_init</title>
<title>{popup_init}</title>
<para>
popup is an integration of overLib, a library used for popup
<link linkend="language.function.popup">{popup}</link>
is an integration of
<ulink url="&url.overLib;">overLib</ulink>, a library used for popup
windows. These are used for context sensitive information, such as
help windows or tooltips. popup_init must be called once at the
top of any page you plan on using the <link
linkend="language.function.popup">popup</link> function. overLib
help windows or tooltips.{popup_init} must be called once at the
top of any page you plan on using the
<link linkend="language.function.popup">{popup}</link> function.
<ulink url="&url.overLib;">overLib</ulink>
was written by Erik Bosrup, and the homepage is located at
http://www.bosrup.com/web/overlib/.
<ulink url="&url.overLib;">&url.overLib;</ulink>.
</para>
<para>
As of Smarty version 2.1.2, overLib does NOT come with the release.
Download overLib, place the overlib.js file under your document
Download overLib, place the 'overlib.js' file under your document
root and supply the relative path to this file as the "src"
parameter to popup_init.
parameter to {popup_init}.
</para>
<example>
<title>popup_init</title>
<programlisting>
<![CDATA[
<head>
{* popup_init must be called once at the top of the page *}
{popup_init src="/javascripts/overlib.js"}
</head>
]]>
</programlisting>
</example>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.popup">
<title>popup</title>
<title>{popup}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -391,10 +391,12 @@
</tgroup>
</informaltable>
<para>
popup is used to create javascript popup windows.
{popup} is used to create javascript popup windows.
<link linkend="language.function.popup.init">{popup_init}</link> MUST be called first for
this to work.
</para>
<example>
<title>popup</title>
<title>{popup}</title>
<programlisting>
<![CDATA[
{* popup_init must be called once at the top of the page *}
@@ -405,11 +407,17 @@
{* you can use html, links, etc in your popup text *}
<a href="mypage.html" {popup sticky=true caption="mypage contents"
text="<ul><li>links</li><li>pages</li><li>images</li></ul>" snapx=10
snapy=10}>mypage</a>
text="<ul><li>links</li><li>pages</li><li>images</li></ul>"
snapx=10 snapy=10}>mypage</a>
]]>
</programlisting>
</example>
<para>
See also
<link linkend="language.function.popup.init">{popup_init}</link>
and
<ulink url="&url.overLib;">overLib</ulink>.
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
@@ -431,3 +439,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.textformat">
<title>textformat</title>
<title>{textformat}</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -82,7 +82,9 @@
</tgroup>
</informaltable>
<para>
textformat is a block function used to format text. It basically
{textformat} is a
<link linkend="plugins.block.functions">block function</link>
used to format text. It basically
cleans up spaces and special characters, and formats paragraphs by
wrapping at a boundary and indenting lines.
</para>
@@ -91,7 +93,7 @@
Currently "email" is the only available style.
</para>
<example>
<title>textformat</title>
<title>{textformat}</title>
<programlisting>
<![CDATA[
{textformat wrap=40}
@@ -264,6 +266,13 @@
]]>
</screen>
</example>
<para>
See also
<link linkend="language.function.strip">{strip}</link>
and
<link linkend="language.modifier.wordwrap">{wordwrap}</link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:

View File

@@ -70,8 +70,8 @@
<link linkend="plugins.modifiers">modifiers</link>,
</para>
&designers.language-modifiers.language-modifier-cat;
&designers.language-modifiers.language-modifier-capitalize;
&designers.language-modifiers.language-modifier-cat;
&designers.language-modifiers.language-modifier-count-characters;
&designers.language-modifiers.language-modifier-count-paragraphs;
&designers.language-modifiers.language-modifier-count-sentences;

View File

@@ -39,15 +39,13 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'next x-men film, x3, delayed.');
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[
@@ -67,7 +65,8 @@ Next X-Men Film, X3, Delayed.
]]>
</screen>
</example>
<para>See also <link linkend="language.modifier.lower">lower</link> <link linkend="language.modifier.upper">upper</link> </para>
<para>See also <link linkend="language.modifier.lower">lower</link> <link
linkend="language.modifier.upper">upper</link> </para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
@@ -89,3 +88,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -37,14 +37,14 @@
<programlisting role="php">
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', "Psychics predict world didn't end");
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[

View File

@@ -39,15 +39,13 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Cold Wave Linked to Temperatures.');
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[
@@ -68,9 +66,10 @@ Cold Wave Linked to Temperatures.
</screen>
</example>
<para>
See also <link linkend="language.modifier.count.paragraphs">count_paragraphs</link>,
See also
<link linkend="language.modifier.count.words">count_words</link>,
<link linkend="language.modifier.count.sentences">count_sentences</link> and
<link linkend="language.modifier.count.words">count_words</link>.
<link linkend="language.modifier.count.paragraphs">count_paragraphs</link>.
</para>
</sect1>

View File

@@ -10,15 +10,17 @@
<programlisting role="php">
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', "War Dims Hope for Peace. Child's Death Ruins
Couple's Holiday.\n\nMan is Fatally Slain. Death Causes Loneliness, Feeling of Isolation.");
$smarty->display('index.tpl');
$smarty->assign('articleTitle',
"War Dims Hope for Peace. Child's Death Ruins Couple's Holiday.\n\n
Man is Fatally Slain. Death Causes Loneliness, Feeling of Isolation."
);
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[

View File

@@ -11,15 +11,16 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe.');
$smarty->display('index.tpl');
$smarty->assign('articleTitle',
'Two Soviet Ships Collide - One Dies.
Enraged Cow Injures Farmer with Axe.'
);
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[

View File

@@ -11,15 +11,13 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[

View File

@@ -53,15 +53,13 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('yesterday', strtotime('-1 day'));
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[
@@ -151,7 +149,8 @@ Monday, February 5, 2001
%n - newline character
</para></listitem>
<listitem><para>
%p - either `am' or `pm' according to the given time value, or the corresponding strings for the current locale
%p - either `am' or `pm' according to the given time value, or the corresponding strings for the
current locale
</para></listitem>
<listitem><para>
%r - time in a.m. and p.m. notation
@@ -172,17 +171,20 @@ Monday, February 5, 2001
%u - weekday as a decimal number [1,7], with 1 representing Monday
</para></listitem>
<listitem><para>
%U - week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week
%U - week number of the current year as a decimal number, starting with the first Sunday as the first
day of the first week
</para></listitem>
<listitem><para>
%V - The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current
%V - The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week
1 is the first week that has at least 4 days in the current
year, and with Monday as the first day of the week.
</para></listitem>
<listitem><para>
%w - day of the week as a decimal, Sunday being 0
</para></listitem>
<listitem><para>
%W - week number of the current year as a decimal number, starting with the first Monday as the first day of the first week
%W - week number of the current year as a decimal number, starting with the first Monday as the first
day of the first week
</para></listitem>
<listitem><para>
%x - preferred date representation for the current locale without the time
@@ -242,3 +244,4 @@ vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -41,15 +41,13 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[

View File

@@ -44,15 +44,15 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', "'Stiff Opposition Expected to Casketless Funeral Plan'");
$smarty->display('index.tpl');
$smarty->assign('articleTitle',
"'Stiff Opposition Expected to Casketless Funeral Plan'"
);
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[

View File

@@ -49,17 +49,18 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'NJ judge to rule on nude beach.
$smarty->assign('articleTitle',
'NJ judge to rule on nude beach.
Sun or rain expected today, dark tonight.
Statistics show that teen pregnancy drops off significantly after 25.');
$smarty->display('index.tpl');
Statistics show that teen pregnancy drops off significantly after 25.'
);
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[

View File

@@ -11,15 +11,13 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Two Convicts Evade Noose, Jury Hung.');
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[

View File

@@ -13,15 +13,15 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', "Sun or rain expected\ntoday, dark tonight");
$smarty->display('index.tpl');
$smarty->assign('articleTitle',
"Sun or rain expected\ntoday, dark tonight"
);
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[

View File

@@ -47,9 +47,7 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', "Infertility unlikely to\nbe passed on, experts say.");
$smarty->display('index.tpl');
?>
]]>

View File

@@ -46,15 +46,13 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', "Child's Stool Great for Use in Garden.");
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[

View File

@@ -39,14 +39,14 @@
<programlisting role="php">
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Something Went Wrong in Jet Crash, Experts Say.');
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[

View File

@@ -40,15 +40,13 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('number', 23.5787446);
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
Where index.tpl is:
Where template is:
</para>
<programlisting>
<![CDATA[

View File

@@ -38,16 +38,16 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', "Blind Woman Gets <font face=\"helvetica\">New
Kidney</font> from Dad she Hasn't Seen in <b>years</b>.");
$smarty->display('index.tpl');
$smarty->assign('articleTitle',
"Blind Woman Gets <font face=\"helvetica\">New
Kidney</font> from Dad she Hasn't Seen in <b>years</b>."
);
?>
]]>
</programlisting>
<para>
where index.tpl is:
where template is:
</para>
<programlisting>
<![CDATA[

View File

@@ -10,7 +10,7 @@
<title>Note</title>
<para>
If you want to strip blocks of template text, use the <link
linkend="language.function.strip">strip function</link>.
linkend="language.function.strip">{strip}</link> function.
</para>
</note>
<example>
@@ -27,7 +27,7 @@ $smarty->display('index.tpl');
]]>
</programlisting>
<para>
where index.tpl is:
where template is:
</para>
<programlisting>
<![CDATA[

View File

@@ -60,15 +60,13 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Two Sisters Reunite after Eighteen Years at Checkout Counter.');
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
where index.tpl is:
where template is:
</para>
<programlisting>
<![CDATA[

View File

@@ -11,15 +11,13 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', "If Strike isn't Settled Quickly it may Last a While.");
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
where index.tpl is:
where template is:
</para>
<programlisting>
<![CDATA[

View File

@@ -46,10 +46,10 @@
</tgroup>
</informaltable>
<para>
This wraps a string to a column width, default is 80. As
<command>wordwrap</command> wraps a string to a column width, default is 80. As
an optional second parameter, you can specify a string of text
to wrap the text to the next line (default is carriage return \n).
By default, wordwrap will attempt to wrap at a word boundary. If
By default, {wordwrap} will attempt to wrap at a word boundary. If
you want to cut off at the exact character length, pass the optional
third parameter of true. This is equivalent to the PHP <ulink
url="&url.php-manual;wordwrap">wordwrap()</ulink> function.
@@ -60,15 +60,15 @@
<![CDATA[
<?php
$smarty = new Smarty;
$smarty->assign('articleTitle', "Blind woman gets new kidney from dad she hasn't seen in years.");
$smarty->display('index.tpl');
$smarty->assign('articleTitle',
"Blind woman gets new kidney from dad she hasn't seen in years."
);
?>
]]>
</programlisting>
<para>
where index.tpl is:
where template is
</para>
<programlisting>
<![CDATA[
@@ -110,7 +110,9 @@ years.
</screen>
</example>
<para>
See also <link linkend="language.modifier.nl2br">nl2br</link>.
See also <link linkend="language.modifier.nl2br">nl2br</link>
and
<link linkend="language.function.textformat">{textformat}</link>.
</para>
</sect1>
@@ -134,3 +136,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

View File

@@ -9,6 +9,7 @@
<!ENTITY ml.general.sub 'smarty-general-subscribe@lists.php.net'>
<!ENTITY url.php-accelerator 'http://www.php-accelerator.co.uk'>
<!ENTITY url.zend 'http://www.zend.com/'>
<!ENTITY url.overLib 'http://www.bosrup.com/web/overlib/'>
<!-- to use like <ulink url="&url.php-manual;some_function"> -->
<!ENTITY url.php-manual 'http://php.net/'>