mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
more patches from Peter: more linking and improvement of examples. thanks :)
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.capture">
|
<sect1 id="language.function.capture">
|
||||||
<title>capture</title>
|
<title>{capture}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -37,13 +37,13 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<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
|
variable instead of displaying it. Any content between {capture
|
||||||
name="foo"} and {/capture} is collected into the variable specified
|
name="foo"} and {/capture} is collected into the variable specified
|
||||||
in the name attribute. The captured content can be used in the
|
in the name attribute. The captured content can be used in the
|
||||||
template from the special variable <link
|
template from the special variable <link
|
||||||
linkend="language.variables.smarty.capture">$smarty.capture.foo</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}
|
supply a name attribute, then "default" will be used. All {capture}
|
||||||
commands must be paired with {/capture}. You can nest capture commands.
|
commands must be paired with {/capture}. You can nest capture commands.
|
||||||
</para>
|
</para>
|
||||||
@@ -58,11 +58,12 @@
|
|||||||
<caution>
|
<caution>
|
||||||
<para>
|
<para>
|
||||||
Be careful when capturing <link
|
Be careful when capturing <link
|
||||||
linkend="language.function.insert"><command>insert</command></link>
|
linkend="language.function.insert">{insert}</link>
|
||||||
output. If you have
|
output. If you have
|
||||||
<link linkend="caching">caching</link>
|
<link linkend="caching">caching</link>
|
||||||
turned on and you have
|
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.
|
within cached content, do not capture this content.
|
||||||
</para>
|
</para>
|
||||||
</caution>
|
</caution>
|
||||||
@@ -75,12 +76,15 @@
|
|||||||
{capture name=banner}
|
{capture name=banner}
|
||||||
{include file="get_banner.tpl"}
|
{include file="get_banner.tpl"}
|
||||||
{/capture}
|
{/capture}
|
||||||
{if $smarty.capture.banner ne ""}
|
|
||||||
|
{if $smarty.capture.banner ne ''}
|
||||||
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{$smarty.capture.banner}
|
{$smarty.capture.banner}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
</table>
|
||||||
{/if}
|
{/if}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.config.load">
|
<sect1 id="language.function.config.load">
|
||||||
<title>config_load</title>
|
<title>{config_load}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -64,13 +64,14 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<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.
|
configuration file into the template.
|
||||||
See <link linkend="config.files">Config Files</link> for more
|
See <link linkend="config.files">Config Files</link> for more
|
||||||
info.
|
info.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>function config_load</title>
|
<title>{config_load}</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{config_load file="colors.conf"}
|
{config_load file="colors.conf"}
|
||||||
@@ -127,8 +128,9 @@
|
|||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>
|
<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="language.config.variables">Config variables</link>,
|
||||||
|
<link linkend="variable.config.dir">$config_dir</link>,
|
||||||
<link linkend="api.get.config.vars">get_config_vars()</link>
|
<link linkend="api.get.config.vars">get_config_vars()</link>
|
||||||
and
|
and
|
||||||
<link linkend="api.config.load">config_load()</link>.
|
<link linkend="api.config.load">config_load()</link>.
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.foreach">
|
<sect1 id="language.function.foreach">
|
||||||
<title>foreach,foreachelse</title>
|
<title>{foreach},{foreachelse}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -56,8 +56,8 @@
|
|||||||
<emphasis>{foreach}</emphasis> loops are an alternative to
|
<emphasis>{foreach}</emphasis> loops are an alternative to
|
||||||
<link
|
<link
|
||||||
linkend="language.function.section"><emphasis>{section}</emphasis></link>
|
linkend="language.function.section"><emphasis>{section}</emphasis></link>
|
||||||
loops. <emphasis>foreach</emphasis> is used to loop over a single
|
loops. <emphasis>{foreach}</emphasis> is used to loop over a
|
||||||
associative array. The syntax for
|
<emphasis role="bold">single associative array</emphasis>. The syntax for
|
||||||
<emphasis>{foreach}</emphasis> is much easier than
|
<emphasis>{foreach}</emphasis> is much easier than
|
||||||
<emphasis>{section}</emphasis>, but as a tradeoff it
|
<emphasis>{section}</emphasis>, but as a tradeoff it
|
||||||
<emphasis role="bold">can only be used
|
<emphasis role="bold">can only be used
|
||||||
@@ -74,10 +74,17 @@
|
|||||||
values in the <emphasis>from</emphasis> variable.
|
values in the <emphasis>from</emphasis> variable.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>foreach</title>
|
<title>{foreach} - item</title>
|
||||||
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
$arr = array( 1001,1002,1003);
|
||||||
|
$smarty->assign('custid', $arr);
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
|
||||||
{* this example will print out all the values of the $custid array *}
|
{* this example will print out all the values of the $custid array *}
|
||||||
{foreach from=$custid item=curr_id}
|
{foreach from=$custid item=curr_id}
|
||||||
id: {$curr_id}<br />
|
id: {$curr_id}<br />
|
||||||
@@ -97,18 +104,25 @@
|
|||||||
</example>
|
</example>
|
||||||
|
|
||||||
<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>
|
<programlisting>
|
||||||
<![CDATA[
|
<![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 name=outer item=contact from=$contacts}
|
||||||
{foreach key=key item=item from=$contact}
|
{foreach key=key item=item from=$contact}
|
||||||
{$key}: {$item}<br />
|
{$key}: {$item}<br />
|
||||||
@@ -131,8 +145,28 @@
|
|||||||
</screen>
|
</screen>
|
||||||
</example>
|
</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>
|
<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:
|
These are indicated like so:
|
||||||
<link linkend="language.variables.smarty.loops">{$smarty.foreach.foreachname.varname}</link>
|
<link linkend="language.variables.smarty.loops">{$smarty.foreach.foreachname.varname}</link>
|
||||||
with
|
with
|
||||||
@@ -143,11 +177,8 @@
|
|||||||
<sect2 id="foreach.property.iteration">
|
<sect2 id="foreach.property.iteration">
|
||||||
<title>iteration</title>
|
<title>iteration</title>
|
||||||
<para>
|
<para>
|
||||||
iteration is used to display the current loop iteration.
|
iteration is used to display the current loop iteration.Iteration always
|
||||||
</para>
|
starts with 1 and is incremented by one on each iteration.
|
||||||
<para>
|
|
||||||
Iteration always starts with 1 and is incremented by one
|
|
||||||
one each iteration.
|
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.if">
|
<sect1 id="language.function.if">
|
||||||
<title>if,elseif,else</title>
|
<title>{if},{elseif},{else}</title>
|
||||||
<para>
|
<para>
|
||||||
<emphasis>{if}</emphasis> statements in Smarty have much the same flexibility as PHP if
|
<emphasis>{if}</emphasis> statements in Smarty have much the same flexibility as PHP if
|
||||||
statements, with a few added features for the template engine.
|
statements, with a few added features for the template engine.
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.include.php">
|
<sect1 id="language.function.include.php">
|
||||||
<title>include_php</title>
|
<title>{include_php}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.include">
|
<sect1 id="language.function.include">
|
||||||
<title>include</title>
|
<title>{include}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.insert">
|
<sect1 id="language.function.insert">
|
||||||
<title>insert</title>
|
<title>{insert}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.ldelim">
|
<sect1 id="language.function.ldelim">
|
||||||
<title>ldelim,rdelim</title>
|
<title>{ldelim},{rdelim}</title>
|
||||||
<para>
|
<para>
|
||||||
ldelim and rdelim are used for escaping template delimiters, in our case
|
ldelim and rdelim are used for escaping template delimiters, in our case
|
||||||
"{" or "}". You can also use <link
|
"{" or "}". You can also use <link
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.literal">
|
<sect1 id="language.function.literal">
|
||||||
<title>literal</title>
|
<title>{literal}</title>
|
||||||
<para>
|
<para>
|
||||||
{literal} tags allow a block of data to be taken literally. This is typically
|
{literal} tags allow a block of data to be taken literally. This is typically
|
||||||
used around javascript or stylesheet blocks where curly braces would
|
used around javascript or stylesheet blocks where curly braces would
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.php">
|
<sect1 id="language.function.php">
|
||||||
<title>php</title>
|
<title>{php}</title>
|
||||||
<para>
|
<para>
|
||||||
{php} tags allow php to be embedded directly into the template. They
|
{php} tags allow php to be embedded directly into the template. They
|
||||||
will not be escaped, regardless of the <link
|
will not be escaped, regardless of the <link
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.section">
|
<sect1 id="language.function.section">
|
||||||
<title>section,sectionelse</title>
|
<title>{section},{sectionelse}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -75,7 +75,9 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<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 must be paired with
|
||||||
<emphasis>{/section}</emphasis> tags. Required parameters are
|
<emphasis>{/section}</emphasis> tags. Required parameters are
|
||||||
<emphasis>name</emphasis> and <emphasis>loop</emphasis>. The name
|
<emphasis>name</emphasis> and <emphasis>loop</emphasis>. The name
|
||||||
@@ -89,13 +91,29 @@
|
|||||||
executed when there are no values in the loop variable.
|
executed when there are no values in the loop variable.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>section</title>
|
<title>{section}</title>
|
||||||
|
|
||||||
|
<programlisting role="php">
|
||||||
|
<![CDATA[
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$data = array(1000,1001,1002);
|
||||||
|
$smarty->assign('custid',$data);
|
||||||
|
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{* this example will print out all the values of the $custid array *}
|
{* this example will print out all the values of the $custid array *}
|
||||||
{section name=customer loop=$custid}
|
{section name=customer loop=$custid}
|
||||||
id: {$custid[customer]}<br />
|
id: {$custid[customer]}<br />
|
||||||
{/section}
|
{/section}
|
||||||
|
<hr />
|
||||||
|
{* print out all the values of the $custid array reversed *}
|
||||||
|
{section name=foo loop=$custid step=-1}
|
||||||
|
{$custid[foo]}
|
||||||
|
{/section}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
@@ -106,23 +124,71 @@
|
|||||||
id: 1000<br />
|
id: 1000<br />
|
||||||
id: 1001<br />
|
id: 1001<br />
|
||||||
id: 1002<br />
|
id: 1002<br />
|
||||||
|
<hr />
|
||||||
|
id: 1002<br />
|
||||||
|
id: 1001<br />
|
||||||
|
id: 1000<br />
|
||||||
]]>
|
]]>
|
||||||
</screen>
|
</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>
|
||||||
|
|
||||||
<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>
|
<programlisting>
|
||||||
<![CDATA[
|
<![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.
|
you can access any variable from the template within the section.
|
||||||
This example assumes that $custid, $name and $address are all
|
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}
|
{section name=customer loop=$custid}
|
||||||
|
<p>
|
||||||
id: {$custid[customer]}<br />
|
id: {$custid[customer]}<br />
|
||||||
name: {$name[customer]}<br />
|
name: {$name[customer]}<br />
|
||||||
address: {$address[customer]}<br />
|
address: {$address[customer]}
|
||||||
<p>
|
</p>
|
||||||
{/section}
|
{/section}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
@@ -131,33 +197,39 @@
|
|||||||
</para>
|
</para>
|
||||||
<screen>
|
<screen>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
<p>
|
||||||
id: 1000<br />
|
id: 1000<br />
|
||||||
name: John Smith<br />
|
name: John Smith<br />
|
||||||
address: 253 N 45th<br />
|
address: 253 N 45th
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
id: 1001<br />
|
id: 1001<br />
|
||||||
name: Jack Jones<br />
|
name: Jack Jones<br />
|
||||||
address: 417 Mulberry ln<br />
|
address: 417 Mulberry ln
|
||||||
|
</p>
|
||||||
<p>
|
<p>
|
||||||
id: 1002<br />
|
id: 1002<br />
|
||||||
name: Jane Munson<br />
|
name: Jane Munson<br />
|
||||||
address: 5605 apple st<br />
|
address: 5605 apple st
|
||||||
<p>
|
</p>
|
||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>section names</title>
|
<title>{section} naming</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{* the name of the section can be anything you like,
|
{*
|
||||||
and it is used to reference the data within the section *}
|
the name of the section can be anything you like,
|
||||||
{section name=mydata loop=$custid}
|
as it is used to reference the data within the section
|
||||||
id: {$custid[mydata]}<br />
|
*}
|
||||||
name: {$name[mydata]}<br />
|
{section name=anything loop=$custid}
|
||||||
address: {$address[mydata]}<br />
|
|
||||||
<p>
|
<p>
|
||||||
|
id: {$custid[anything]}<br />
|
||||||
|
name: {$name[anything]}<br />
|
||||||
|
address: {$address[anything]}
|
||||||
|
</p>
|
||||||
{/section}
|
{/section}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
@@ -165,20 +237,52 @@
|
|||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>nested sections</title>
|
<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>
|
<programlisting>
|
||||||
<![CDATA[
|
<![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
|
you can access complex data structures, such as multi-dimensional
|
||||||
arrays. In this example, $contact_type[customer] is an array of
|
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}
|
{section name=customer loop=$custid}
|
||||||
|
<hr>
|
||||||
id: {$custid[customer]}<br />
|
id: {$custid[customer]}<br />
|
||||||
name: {$name[customer]}<br />
|
name: {$name[customer]}<br />
|
||||||
address: {$address[customer]}<br />
|
address: {$address[customer]}<br />
|
||||||
{section name=contact loop=$contact_type[customer]}
|
{section name=contact loop=$contact_type[customer]}
|
||||||
{$contact_type[customer][contact]}: {$contact_info[customer][contact]}<br />
|
{$contact_type[customer][contact]}: {$contact_info[customer][contact]}<br />
|
||||||
{/section}
|
{/section}
|
||||||
<p>
|
|
||||||
{/section}
|
{/section}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
@@ -187,42 +291,62 @@
|
|||||||
</para>
|
</para>
|
||||||
<screen>
|
<screen>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
<hr>
|
||||||
id: 1000<br />
|
id: 1000<br />
|
||||||
name: John Smith<br />
|
name: John Smith<br />
|
||||||
address: 253 N 45th<br />
|
address: 253 N 45th<br />
|
||||||
home phone: 555-555-5555<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 />
|
e-mail: john@myexample.com<br />
|
||||||
<p>
|
<hr>
|
||||||
id: 1001<br />
|
id: 1001<br />
|
||||||
name: Jack Jones<br />
|
name: Jack Jones<br />
|
||||||
address: 417 Mulberry ln<br />
|
address: 417 Mulberry ln<br />
|
||||||
home phone: 555-555-5555<br />
|
home phone: 123-456-4<br />
|
||||||
cell phone: 555-555-5555<br />
|
web: www.example.com<br />
|
||||||
e-mail: jack@myexample.com<br />
|
|
||||||
<p>
|
<hr>
|
||||||
id: 1002<br />
|
id: 1002<br />
|
||||||
name: Jane Munson<br />
|
name: Jane Munson<br />
|
||||||
address: 5605 apple st<br />
|
address: 5605 apple st<br />
|
||||||
home phone: 555-555-5555<br />
|
cell phone: 0457878<br />
|
||||||
cell phone: 555-555-5555<br />
|
|
||||||
e-mail: jane@myexample.com<br />
|
|
||||||
<p>
|
|
||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>sections and associative arrays</title>
|
<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>
|
<programlisting>
|
||||||
<![CDATA[
|
<![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}
|
{section name=customer loop=$contacts}
|
||||||
|
<p>
|
||||||
name: {$contacts[customer].name}<br />
|
name: {$contacts[customer].name}<br />
|
||||||
home: {$contacts[customer].home}<br />
|
home: {$contacts[customer].home}<br />
|
||||||
cell: {$contacts[customer].cell}<br />
|
cell: {$contacts[customer].cell}<br />
|
||||||
e-mail: {$contacts[customer].email}<p>
|
e-mail: {$contacts[customer].email}
|
||||||
|
</p>
|
||||||
{/section}
|
{/section}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
@@ -231,24 +355,62 @@
|
|||||||
</para>
|
</para>
|
||||||
<screen>
|
<screen>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
<p>
|
||||||
name: John Smith<br />
|
name: John Smith<br />
|
||||||
home: 555-555-5555<br />
|
home: 555-555-5555<br />
|
||||||
cell: 555-555-5555<br />
|
cell: 666-555-5555<br />
|
||||||
e-mail: john@myexample.com<p>
|
e-mail: john@myexample.com
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
name: Jack Jones<br />
|
name: Jack Jones<br />
|
||||||
home phone: 555-555-5555<br />
|
home phone: 777-555-5555<br />
|
||||||
cell phone: 555-555-5555<br />
|
cell phone: 888-555-5555<br />
|
||||||
e-mail: jack@myexample.com<p>
|
e-mail: jack@myexample.com
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
name: Jane Munson<br />
|
name: Jane Munson<br />
|
||||||
home phone: 555-555-5555<br />
|
home phone: 000-555-5555<br />
|
||||||
cell phone: 555-555-5555<br />
|
cell phone: 123456<br />
|
||||||
e-mail: jane@myexample.com<p>
|
e-mail: jane@myexample.com
|
||||||
|
</p>
|
||||||
]]>
|
]]>
|
||||||
</screen>
|
</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> </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>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>sectionelse</title>
|
<title>{sectionelse}</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{* sectionelse will execute if there are no $custid values *}
|
{* sectionelse will execute if there are no $custid values *}
|
||||||
@@ -268,16 +430,15 @@
|
|||||||
<note>
|
<note>
|
||||||
<para>
|
<para>
|
||||||
As of Smarty 1.5.0, the syntax for section property variables has
|
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
|
{$smarty.section.sectionname.varname}. The old syntax is still
|
||||||
supported, but you will only see reference to the new syntax in the
|
supported, but you will only see examples of the new syntax.
|
||||||
manual examples.
|
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<sect2 id="section.property.index">
|
<sect2 id="section.property.index">
|
||||||
<title>index</title>
|
<title>index</title>
|
||||||
<para>
|
<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
|
(or the start attribute if given), and incrementing by one (or by
|
||||||
the step attribute if given.)
|
the step attribute if given.)
|
||||||
</para>
|
</para>
|
||||||
@@ -287,13 +448,15 @@
|
|||||||
If the step and start section properties are not
|
If the step and start section properties are not
|
||||||
modified, then this works the same as the <link
|
modified, then this works the same as the <link
|
||||||
linkend="section.property.iteration">iteration</link> section
|
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>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<example>
|
<example>
|
||||||
<title>section property index</title>
|
<title>{section} property index</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
|
||||||
|
|
||||||
{section name=customer loop=$custid}
|
{section name=customer loop=$custid}
|
||||||
{$smarty.section.customer.index} id: {$custid[customer]}<br />
|
{$smarty.section.customer.index} id: {$custid[customer]}<br />
|
||||||
{/section}
|
{/section}
|
||||||
@@ -311,40 +474,16 @@
|
|||||||
</screen>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
|
|
||||||
<sect2 id="section.property.index.prev">
|
<sect2 id="section.property.index.prev">
|
||||||
<title>index_prev</title>
|
<title>index_prev</title>
|
||||||
<para>
|
<para>
|
||||||
index_prev is used to display the previous loop index.
|
index_prev is used to display the previous loop index.
|
||||||
on the first loop, this is set to -1.
|
on the first loop, this is set to -1.
|
||||||
</para>
|
</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>
|
||||||
|
|
||||||
<sect2 id="section.property.index.next">
|
<sect2 id="section.property.index.next">
|
||||||
<title>index_next</title>
|
<title>index_next</title>
|
||||||
<para>
|
<para>
|
||||||
@@ -352,34 +491,56 @@
|
|||||||
loop, this is still one more than the current index (respecting the
|
loop, this is still one more than the current index (respecting the
|
||||||
setting of the step attribute, if given.)
|
setting of the step attribute, if given.)
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<example>
|
<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>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{section name=customer loop=$custid}
|
{* FYI, $custid[cus.index] and $custid[cus] are identical in meaning *}
|
||||||
{$smarty.section.customer.index} id: {$custid[customer]}<br />
|
|
||||||
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
|
<table>
|
||||||
{if $custid[customer.index_next] ne $custid[customer.index]}
|
<tr>
|
||||||
The customer id will change<br />
|
<th>index</th><th>id</th>
|
||||||
{/if}
|
<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}
|
{/section}
|
||||||
|
</table>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
The above example will output:
|
The above example will output a table containing the following:
|
||||||
</para>
|
</para>
|
||||||
<screen>
|
<screen>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
0 id: 1000<br />
|
index id index_prev previd index_next nextid
|
||||||
The customer id will change<br />
|
0 1001 -1 1 1002
|
||||||
1 id: 1001<br />
|
1 1002 0 1001 2 1003
|
||||||
The customer id will change<br />
|
2 1003 1 1002 3 1004
|
||||||
2 id: 1002<br />
|
3 1004 2 1003 4 1005
|
||||||
The customer id will change<br />
|
4 1005 3 1004 5
|
||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
|
|
||||||
<sect2 id="section.property.iteration">
|
<sect2 id="section.property.iteration">
|
||||||
<title>iteration</title>
|
<title>iteration</title>
|
||||||
<para>
|
<para>
|
||||||
@@ -395,16 +556,24 @@
|
|||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<example>
|
<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>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{section name=customer loop=$custid start=5 step=2}
|
{section name=cu loop=$custid start=5 step=2}
|
||||||
current loop iteration: {$smarty.section.customer.iteration}<br />
|
iteration={$smarty.section.cu.iteration}
|
||||||
{$smarty.section.customer.index} id: {$custid[customer]}<br />
|
index={$smarty.section.cu.index}
|
||||||
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
|
id={$custid[cu]}<br />
|
||||||
{if $custid[customer.index_next] ne $custid[customer.index]}
|
|
||||||
The customer id will change<br />
|
|
||||||
{/if}
|
|
||||||
{/section}
|
{/section}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
@@ -413,95 +582,91 @@
|
|||||||
</para>
|
</para>
|
||||||
<screen>
|
<screen>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
current loop iteration: 1
|
iteration=1 index=5 id=3005<br />
|
||||||
5 id: 1000<br />
|
iteration=2 index=7 id=3007<br />
|
||||||
The customer id will change<br />
|
iteration=3 index=9 id=3009<br />
|
||||||
current loop iteration: 2
|
iteration=4 index=11 id=3011<br />
|
||||||
7 id: 1001<br />
|
iteration=5 index=13 id=3013<br />
|
||||||
The customer id will change<br />
|
iteration=6 index=15 id=3015<br />
|
||||||
current loop iteration: 3
|
|
||||||
9 id: 1002<br />
|
|
||||||
The customer id will change<br />
|
|
||||||
]]>
|
]]>
|
||||||
</screen>
|
</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> </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>
|
||||||
|
|
||||||
|
|
||||||
<sect2 id="section.property.first">
|
<sect2 id="section.property.first">
|
||||||
<title>first</title>
|
<title>first</title>
|
||||||
<para>
|
<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.
|
one.
|
||||||
</para>
|
</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>
|
||||||
|
|
||||||
|
|
||||||
<sect2 id="section.property.last">
|
<sect2 id="section.property.last">
|
||||||
<title>last</title>
|
<title>last</title>
|
||||||
<para>
|
<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.
|
one.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<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>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{section name=customer loop=$custid}
|
{section name=customer loop=$customers}
|
||||||
{if $smarty.section.customer.first}
|
{if $smarty.section.customer.first}
|
||||||
<table>
|
<table>
|
||||||
|
<tr><th>id</th><th>customer</th></tr>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<tr><td>{$smarty.section.customer.index} id:
|
<tr>
|
||||||
{$custid[customer]}</td></tr>
|
<td>{$customers[customer].id}}</td>
|
||||||
|
<td>{$customers[customer].name}</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
{if $smarty.section.customer.last}
|
{if $smarty.section.customer.last}
|
||||||
|
<tr><td></td><td>{$smarty.section.customer.total} customers</td></tr>
|
||||||
</table>
|
</table>
|
||||||
{/if}
|
{/if}
|
||||||
{/section}
|
{/section}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</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>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
|
|
||||||
<sect2 id="section.property.rownum">
|
<sect2 id="section.property.rownum">
|
||||||
<title>rownum</title>
|
<title>rownum</title>
|
||||||
<para>
|
<para>
|
||||||
@@ -510,26 +675,6 @@
|
|||||||
linkend="section.property.iteration">iteration</link>, they work
|
linkend="section.property.iteration">iteration</link>, they work
|
||||||
identically.
|
identically.
|
||||||
</para>
|
</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>
|
||||||
<sect2 id="section.property.loop">
|
<sect2 id="section.property.loop">
|
||||||
<title>loop</title>
|
<title>loop</title>
|
||||||
@@ -538,7 +683,7 @@
|
|||||||
looped. This can be used inside or after the section.
|
looped. This can be used inside or after the section.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>section property index</title>
|
<title>{section} property index</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{section name=customer loop=$custid}
|
{section name=customer loop=$custid}
|
||||||
@@ -567,15 +712,17 @@
|
|||||||
<para>
|
<para>
|
||||||
<emphasis>show</emphasis> is used as a parameter to section.
|
<emphasis>show</emphasis> is used as a parameter to section.
|
||||||
<emphasis>show</emphasis> is a boolean value, true or false. If
|
<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.
|
present, that will be alternately displayed.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>section attribute show</title>
|
<title>{section} attribute show</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![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}
|
{section name=customer loop=$custid show=$show_customer_info}
|
||||||
{$smarty.section.customer.rownum} id: {$custid[customer]}<br />
|
{$smarty.section.customer.rownum} id: {$custid[customer]}<br />
|
||||||
{/section}
|
{/section}
|
||||||
@@ -608,7 +755,7 @@
|
|||||||
will loop. This can be used inside or after the section.
|
will loop. This can be used inside or after the section.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>section property total</title>
|
<title>{section} property total</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{section name=customer loop=$custid step=2}
|
{section name=customer loop=$custid step=2}
|
||||||
@@ -624,8 +771,8 @@
|
|||||||
<screen>
|
<screen>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
0 id: 1000<br />
|
0 id: 1000<br />
|
||||||
2 id: 1001<br />
|
2 id: 1002<br />
|
||||||
4 id: 1002<br />
|
4 id: 1004<br />
|
||||||
|
|
||||||
There were 3 customers shown above.
|
There were 3 customers shown above.
|
||||||
]]>
|
]]>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.strip">
|
<sect1 id="language.function.strip">
|
||||||
<title>strip</title>
|
<title>{strip}</title>
|
||||||
<para>
|
<para>
|
||||||
Many times web designers run into the issue where white space and
|
Many times web designers run into the issue where white space and
|
||||||
carriage returns affect the output of the rendered HTML (browser
|
carriage returns affect the output of the rendered HTML (browser
|
||||||
@@ -20,8 +20,8 @@
|
|||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
<para>
|
<para>
|
||||||
{strip}{/strip} does not affect the contents of template variables.
|
{strip}{/strip} does not affect the contents of template variables.
|
||||||
See the <link linkend="language.modifier.strip">strip modifier
|
See the
|
||||||
function</link>.
|
<link linkend="language.modifier.strip">strip modifier</link>.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<example>
|
<example>
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
</para>
|
</para>
|
||||||
<screen>
|
<screen>
|
||||||
<![CDATA[
|
<![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>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
@@ -57,6 +57,10 @@
|
|||||||
If you have plain text at the beginning or end of any line,
|
If you have plain text at the beginning or end of any line,
|
||||||
they will be run together, and may not be desired results.
|
they will be run together, and may not be desired results.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="language.modifier.strip">strip modifier</link>
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- 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
|
vim: et tw=78 syn=sgml
|
||||||
vi: ts=1 sw=1
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@@ -11,15 +11,18 @@
|
|||||||
<title>combining modifiers</title>
|
<title>combining modifiers</title>
|
||||||
<programlisting role="php">
|
<programlisting role="php">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
index.php:
|
|
||||||
<?php
|
<?php
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('articleTitle', 'Smokers are Productive, but Death Cuts Efficiency.');
|
$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}
|
||||||
{$articleTitle|upper|spacify}
|
{$articleTitle|upper|spacify}
|
||||||
{$articleTitle|lower|spacify|truncate}
|
{$articleTitle|lower|spacify|truncate}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.assign">
|
<sect1 id="language.function.assign">
|
||||||
<title>assign</title>
|
<title>{assign}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.counter">
|
<sect1 id="language.function.counter">
|
||||||
<title>counter</title>
|
<title>{counter}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -65,7 +65,7 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<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
|
count on each iteration. You can adjust the number, the interval
|
||||||
and the direction of the count, as well as determine whether or not
|
and the direction of the count, as well as determine whether or not
|
||||||
to print the value. You can run multiple counters concurrently by
|
to print the value. You can run multiple counters concurrently by
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.cycle">
|
<sect1 id="language.function.cycle">
|
||||||
<title>cycle</title>
|
<title>{cycle}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -68,12 +68,12 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<para>
|
||||||
Cycle is used to cycle though a set of values. This makes it easy
|
{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
|
to alternate for example between two or more colors in a table, or cycle
|
||||||
through an array of values.
|
through an array of values.
|
||||||
</para>
|
</para>
|
||||||
<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
|
by supplying a name attribute. Give each set of values a unique
|
||||||
name.
|
name.
|
||||||
</para>
|
</para>
|
||||||
@@ -84,11 +84,11 @@
|
|||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
The advance attribute is used to repeat a value. When set to false,
|
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>
|
||||||
<para>
|
<para>
|
||||||
If you supply the special "assign" attribute, the output of the
|
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.
|
being output to the template.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.debug">
|
<sect1 id="language.function.debug">
|
||||||
<title>debug</title>
|
<title>{debug}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.eval">
|
<sect1 id="language.function.eval">
|
||||||
<title>eval</title>
|
<title>{eval}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -38,13 +38,13 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<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
|
for things like embedding template tags/variables into variables or
|
||||||
tags/variables into config file variables.
|
tags/variables into config file variables.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
If you supply the special "assign" attribute, the output of the
|
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.
|
being output to the template.
|
||||||
</para>
|
</para>
|
||||||
<note>
|
<note>
|
||||||
@@ -59,12 +59,14 @@
|
|||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
<para>
|
<para>
|
||||||
Evaluated variables are compiled on every invocation, the compiled
|
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.
|
output will be cached with the rest of the template.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<example>
|
<example>
|
||||||
<title>eval</title>
|
<title>{eval}</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
setup.conf
|
setup.conf
|
||||||
@@ -96,7 +98,6 @@
|
|||||||
</para>
|
</para>
|
||||||
<screen>
|
<screen>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
|
||||||
This is the contents of foo.
|
This is the contents of foo.
|
||||||
Welcome to Foobar Pub & Grill's home page!
|
Welcome to Foobar Pub & Grill's home page!
|
||||||
You must supply a <strong>city</strong>.
|
You must supply a <strong>city</strong>.
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.fetch">
|
<sect1 id="language.function.fetch">
|
||||||
<title>fetch</title>
|
<title>{fetch}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.html.checkboxes">
|
<sect1 id="language.function.html.checkboxes">
|
||||||
<title>html_checkboxes</title>
|
<title>{html_checkboxes}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -72,7 +72,9 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<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
|
group with provided data. It takes care of which item(s) are
|
||||||
selected by default as well. Required attributes are values and
|
selected by default as well. Required attributes are values and
|
||||||
output, unless you use options instead. All output is XHTML
|
output, unless you use options instead. All output is XHTML
|
||||||
@@ -83,30 +85,29 @@
|
|||||||
name/value-pairs inside each of the created <input>-tags.
|
name/value-pairs inside each of the created <input>-tags.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>html_checkboxes</title>
|
<title>{html_checkboxes}</title>
|
||||||
<para>
|
|
||||||
where PHP code is:
|
|
||||||
</para>
|
|
||||||
<programlisting role="php">
|
<programlisting role="php">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require('Smarty.class.php');
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
|
$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->assign('customer_id', 1001);
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
and index.tpl is:
|
where template is
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![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>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
@@ -116,20 +117,18 @@ $smarty->display('index.tpl');
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require('Smarty.class.php');
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('cust_checkboxes', array(
|
$smarty->assign('cust_checkboxes', array(
|
||||||
1000 => 'Joe Schmoe',
|
1000 => 'Joe Schmoe',
|
||||||
1001 => 'Jack Smith',
|
1001 => 'Jack Smith',
|
||||||
1002 => 'Jane Johnson',
|
1002 => 'Jane Johnson',
|
||||||
1003 => 'Charlie Brown'));
|
1003 => 'Charlie Brown'));
|
||||||
$smarty->assign('customer_id', 1001);
|
$smarty->assign('customer_id', 1001);
|
||||||
$smarty->display('index.tpl');
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
and index.tpl is:
|
and the template is
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
@@ -142,12 +141,42 @@ $smarty->display('index.tpl');
|
|||||||
<screen>
|
<screen>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
<label><input type="checkbox" name="id[]" value="1000" />Joe Schmoe</label><br />
|
<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="1002" />Jane Johnson</label><br />
|
||||||
<label><input type="checkbox" name="id[]" value="1003" />Charlie Brown</label><br />
|
<label><input type="checkbox" name="id[]" value="1003" />Charlie Brown</label><br />
|
||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
</example>
|
</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>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
@@ -169,3 +198,6 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
|||||||
vim: et tw=78 syn=sgml
|
vim: et tw=78 syn=sgml
|
||||||
vi: ts=1 sw=1
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.html.image">
|
<sect1 id="language.function.html.image">
|
||||||
<title>html_image</title>
|
<title>{html_image}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -65,58 +65,52 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<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. The height and width are automatically calculated from the
|
||||||
image file if none are supplied.
|
image file if none are supplied.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
basedir is the base directory that relative image paths are based
|
basedir is the base directory that relative image paths are based
|
||||||
from. If not given, the web server document root (env variable
|
from. If not given, the web server document root (
|
||||||
DOCUMENT_ROOT) is used as the base. If security is enabled, the
|
<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.
|
path to the image must be within a secure directory.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
<parameter>href</parameter> is the href value to link the image to. If link is supplied, an
|
<parameter>href</parameter> is the href value to link the image to. If link is supplied, an
|
||||||
<a href="LINKVALUE"><a> tag is put around the image tag.
|
<a href="LINKVALUE"><a> tag is placed around the image tag.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
All parameters that are not in the list above are printed as
|
All parameters that are not in the list above are printed as
|
||||||
name/value-pairs inside the created <img>-tag.
|
name/value-pairs inside the created <img> tag.
|
||||||
</para>
|
</para>
|
||||||
<note>
|
<note>
|
||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
<para>
|
<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
|
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.
|
image tags static for optimal performance.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<example>
|
<example>
|
||||||
<title>html_image example</title>
|
<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>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
where index.tpl is:
|
||||||
|
-------------------
|
||||||
{html_image file="pumpkin.jpg"}
|
{html_image file="pumpkin.jpg"}
|
||||||
{html_image file="/path/from/docroot/pumpkin.jpg"}
|
{html_image file="/path/from/docroot/pumpkin.jpg"}
|
||||||
{html_image file="../path/relative/to/currdir/pumpkin.jpg"}
|
{html_image file="../path/relative/to/currdir/pumpkin.jpg"}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
a possible output would be:
|
possible output would be:
|
||||||
</para>
|
</para>
|
||||||
<screen>
|
<screen>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.html.options">
|
<sect1 id="language.function.html.options">
|
||||||
<title>html_options</title>
|
<title>{html_options}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -58,90 +58,90 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<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 <select><option> group
|
||||||
with provided data. It takes care of which item(s) are selected by
|
with provided data. It takes care of which item(s) are selected by
|
||||||
default as well. Required attributes are values and output, unless
|
default as well. Required attributes are values and output, unless
|
||||||
you use options instead.
|
you use options instead.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
If a given value is an array, it will treat it as an html OPTGROUP,
|
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
|
and display the groups. Recursion is supported with <optgroup>. All
|
||||||
output is XHTML compatible.
|
output is XHTML compatible.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
If the optional <emphasis>name</emphasis> attribute is given, the
|
If the optional <emphasis>name</emphasis> attribute is given, the
|
||||||
<select name="groupname"></select> tags will enclose
|
<select name="groupname"></select> tags will enclose
|
||||||
the option list. Otherwise only the option list is generated.
|
the option list. Otherwise only the <option> list is generated.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
All parameters that are not in the list above are printed as
|
All parameters that are not in the list above are printed as
|
||||||
name/value-pairs inside the <select>-tag. They are ignored if
|
name/value-pairs inside the <select> tag. They are ignored if
|
||||||
the optional <emphasis>name</emphasis> is not given.
|
the optional <emphasis>name</emphasis> is not given.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>html_options : Example 1</title>
|
<title>{html_options}</title>
|
||||||
<programlisting>
|
<para>
|
||||||
|
<emphasis role="bold">Example 2:</emphasis>
|
||||||
|
</para>
|
||||||
|
<programlisting role="php">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
index.php:
|
<?php
|
||||||
----------
|
|
||||||
|
|
||||||
require('Smarty.class.php');
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
|
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
|
||||||
$smarty->assign('cust_names', array('Joe Schmoe','Jack Smith','Jane
|
$smarty->assign('cust_names', array(
|
||||||
Johnson','Charlie Brown'));
|
'Joe Schmoe',
|
||||||
|
'Jack Smith',
|
||||||
|
'Jane Johnson',
|
||||||
|
'Charlie Brown'));
|
||||||
$smarty->assign('customer_id', 1001);
|
$smarty->assign('customer_id', 1001);
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
|
||||||
<select name=customer_id>
|
<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>
|
</select>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Example 2
|
<emphasis role="bold">Example 2:</emphasis>
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting role="php">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
index.php:
|
<?php
|
||||||
----------
|
|
||||||
|
|
||||||
require('Smarty.class.php');
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('cust_options', array(
|
$smarty->assign('cust_options', array(
|
||||||
1001 => 'Joe Schmoe',
|
1001 => 'Joe Schmoe',
|
||||||
1002 => 'Jack Smith',
|
1002 => 'Jack Smith',
|
||||||
1003 => 'Jane Johnson',
|
1003 => 'Jane Johnson',
|
||||||
1004 => 'Charlie Brown'));
|
1004 => 'Charlie Brown'));
|
||||||
$smarty->assign('customer_id', 1001);
|
$smarty->assign('customer_id', 1001);
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
|
||||||
<select name=customer_id>
|
<select name=customer_id>
|
||||||
{html_options options=$cust_options selected=$customer_id}
|
{html_options options=$cust_options selected=$customer_id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Both examples will output:
|
Both the above examples will output:
|
||||||
</para>
|
</para>
|
||||||
<screen>
|
<screen>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
|
||||||
<select name=customer_id>
|
<select name=customer_id>
|
||||||
<option label="Joe Schmoe" value="1000">Joe Schmoe</option>
|
<option label="Joe Schmoe" value="1000">Joe Schmoe</option>
|
||||||
<option label="Jack Smith" value="1001" selected="selected">Jack Smith</option>
|
<option label="Jack Smith" value="1001" selected="selected">Jack Smith</option>
|
||||||
@@ -152,6 +152,38 @@
|
|||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
</example>
|
</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>
|
</sect1>
|
||||||
|
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.html.radios">
|
<sect1 id="language.function.html.radios">
|
||||||
<title>html_radios</title>
|
<title>{html_radios}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -65,7 +65,9 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<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
|
group with provided data. It takes care of which item is selected
|
||||||
by default as well. Required attributes are values and output,
|
by default as well. Required attributes are values and output,
|
||||||
unless you use options instead. All output is XHTML compatible.
|
unless you use options instead. All output is XHTML compatible.
|
||||||
@@ -76,46 +78,46 @@
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>html_radios : Example 1</title>
|
<title>{html_radios} : Example 1</title>
|
||||||
<programlisting>
|
<programlisting role="php">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
index.php:
|
<?php
|
||||||
----------
|
|
||||||
|
|
||||||
require('Smarty.class.php');
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
|
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
|
||||||
$smarty->assign('cust_names', array('Joe Schmoe','Jack Smith','Jane
|
$smarty->assign('cust_names', array(
|
||||||
Johnson','Charlie Brown'));
|
'Joe Schmoe',
|
||||||
|
'Jack Smith',
|
||||||
|
'Jane Johnson',
|
||||||
|
'Charlie Brown'));
|
||||||
$smarty->assign('customer_id', 1001);
|
$smarty->assign('customer_id', 1001);
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![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>
|
</programlisting>
|
||||||
<para>
|
</example>
|
||||||
Example 2 :
|
<example>
|
||||||
</para>
|
<title>{html_radios} : Example 2</title>
|
||||||
<programlisting>
|
<programlisting role="php">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
index.php:
|
<?php
|
||||||
----------
|
|
||||||
|
|
||||||
require('Smarty.class.php');
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('cust_radios', array(
|
$smarty->assign('cust_radios', array(
|
||||||
1000 => 'Joe Schmoe',
|
1000 => 'Joe Schmoe',
|
||||||
1001 => 'Jack Smith',
|
1001 => 'Jack Smith',
|
||||||
1002 => 'Jane Johnson',
|
1002 => 'Jane Johnson',
|
||||||
1003 => 'Charlie Brown'));
|
1003 => 'Charlie Brown'));
|
||||||
$smarty->assign('customer_id', 1001);
|
$smarty->assign('customer_id', 1001);
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
@@ -131,13 +133,48 @@
|
|||||||
</para>
|
</para>
|
||||||
<screen>
|
<screen>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
<label for="id_1000"><input type="radio" name="id" value="1000" id="id_1000" />Joe Schmoe</label><br />
|
<label for="id_1000"><input type="radio" name="id" value="1000" id="id_1000" />Joe
|
||||||
<label for="id_1001"><input type="radio" name="id" value="1001" id="id_1001" checked="checked" />Jack Smith</label><br />
|
Schmoe</label><br />
|
||||||
<label for="id_1002"><input type="radio" name="id" value="1002" id="id_1002" />Jane Johnson</label><br />
|
<label for="id_1001"><input type="radio" name="id" value="1001" id="id_1001"
|
||||||
<label for="id_1003"><input type="radio" name="id" value="1003" id="id_1003" />Charlie Brown</label><br />
|
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>
|
</screen>
|
||||||
</example>
|
</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>
|
</sect1>
|
||||||
|
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- 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
|
vim: et tw=78 syn=sgml
|
||||||
vi: ts=1 sw=1
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.html.select.date">
|
<sect1 id="language.function.html.select.date">
|
||||||
<title>html_select_date</title>
|
<title>{html_select_date}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -222,13 +222,17 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<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.
|
for you. It can display any or all of year, month, and day.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>html_select_date</title>
|
<title>{html_select_date}</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
template code:
|
||||||
|
-------------
|
||||||
{html_select_date}
|
{html_select_date}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
@@ -241,12 +245,7 @@
|
|||||||
<option value="1">January</option>
|
<option value="1">January</option>
|
||||||
<option value="2">February</option>
|
<option value="2">February</option>
|
||||||
<option value="3">March</option>
|
<option value="3">March</option>
|
||||||
<option value="4">April</option>
|
..... snipped .....
|
||||||
<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>
|
|
||||||
<option value="10">October</option>
|
<option value="10">October</option>
|
||||||
<option value="11">November</option>
|
<option value="11">November</option>
|
||||||
<option value="12" selected="selected">December</option>
|
<option value="12" selected="selected">December</option>
|
||||||
@@ -255,31 +254,13 @@
|
|||||||
<option value="1">01</option>
|
<option value="1">01</option>
|
||||||
<option value="2">02</option>
|
<option value="2">02</option>
|
||||||
<option value="3">03</option>
|
<option value="3">03</option>
|
||||||
<option value="4">04</option>
|
..... snipped .....
|
||||||
<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>
|
|
||||||
<option value="11">11</option>
|
<option value="11">11</option>
|
||||||
<option value="12">12</option>
|
<option value="12">12</option>
|
||||||
<option value="13" selected="selected">13</option>
|
<option value="13" selected="selected">13</option>
|
||||||
<option value="14">14</option>
|
<option value="14">14</option>
|
||||||
<option value="15">15</option>
|
<option value="15">15</option>
|
||||||
<option value="16">16</option>
|
..... snipped .....
|
||||||
<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>
|
|
||||||
<option value="29">29</option>
|
<option value="29">29</option>
|
||||||
<option value="30">30</option>
|
<option value="30">30</option>
|
||||||
<option value="31">31</option>
|
<option value="31">31</option>
|
||||||
@@ -292,11 +273,12 @@
|
|||||||
</example>
|
</example>
|
||||||
|
|
||||||
<example>
|
<example>
|
||||||
<title>html_select_date</title>
|
<title>{html_select_date}</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{* start and end year can be relative to current year *}
|
{* 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>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
@@ -358,3 +340,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
|||||||
vim: et tw=78 syn=sgml
|
vim: et tw=78 syn=sgml
|
||||||
vi: ts=1 sw=1
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.html.select.time">
|
<sect1 id="language.function.html.select.time">
|
||||||
<title>html_select_time</title>
|
<title>{html_select_time}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -133,22 +133,24 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<para>
|
||||||
{html_select_time} is a custom function that
|
{html_select_time} is a
|
||||||
creates time dropdowns for you. It can display
|
<link linkend="language.custom.functions">custom function</link>
|
||||||
any or all of hour, minute, second and
|
that creates time dropdowns for you. It can display
|
||||||
meridian.
|
any or all of hour, minute, second and meridian.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
The time-attribute can have different
|
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
|
string of the format YYYYMMDDHHMMSS or a string
|
||||||
that is parseable by php's
|
that is parseable by php's
|
||||||
<ulink url="&url.php-manual;strtotime">strtotime()</ulink>.
|
<ulink url="&url.php-manual;strtotime">strtotime()</ulink>.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>html_select_time</title>
|
<title>{html_select_time}</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
template code:
|
||||||
|
--------------
|
||||||
{html_select_time use_24_hours=true}
|
{html_select_time use_24_hours=true}
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.html.table">
|
<sect1 id="language.function.html.table">
|
||||||
<title>html_table</title>
|
<title>{html_table}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -117,7 +117,9 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<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
|
data into an HTML table. The <emphasis>cols</emphasis> attribute determines
|
||||||
how many columns will be in the table. The <emphasis>table_attr</emphasis>,
|
how many columns will be in the table. The <emphasis>table_attr</emphasis>,
|
||||||
<emphasis>tr_attr</emphasis> and <emphasis>td_attr</emphasis> values
|
<emphasis>tr_attr</emphasis> and <emphasis>td_attr</emphasis> values
|
||||||
@@ -131,6 +133,8 @@
|
|||||||
<title>html_table</title>
|
<title>html_table</title>
|
||||||
<programlisting role="php">
|
<programlisting role="php">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
php code:
|
||||||
|
---------
|
||||||
<?php
|
<?php
|
||||||
require('Smarty.class.php');
|
require('Smarty.class.php');
|
||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
@@ -142,6 +146,8 @@ $smarty->display('index.tpl');
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
template code:
|
||||||
|
--------------
|
||||||
{html_table loop=$data}
|
{html_table loop=$data}
|
||||||
{html_table loop=$data cols=4 table_attr='border="0"'}
|
{html_table loop=$data cols=4 table_attr='border="0"'}
|
||||||
{html_table loop=$data cols=4 tr_attr=$tr}
|
{html_table loop=$data cols=4 tr_attr=$tr}
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.mailto">
|
<sect1 id="language.function.mailto">
|
||||||
<title>mailto</title>
|
<title>{mailto}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -91,9 +91,9 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<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
|
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>
|
</para>
|
||||||
<note>
|
<note>
|
||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
@@ -103,42 +103,49 @@
|
|||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<example>
|
<example>
|
||||||
<title>mailto</title>
|
<title>{mailto}</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{mailto address="me@example.com"}
|
{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"}
|
{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"}
|
{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"}
|
{mailto address="me@example.com" encode="hex"}
|
||||||
|
<a href="mailto:%6d%65.. snipped..3%6f%6d">m&..snipped...#x6f;m</a>
|
||||||
|
|
||||||
{mailto address="me@example.com" subject="Hello to you!"}
|
{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" >me@domain.com</a>
|
|
||||||
<a href="mailto:me@example.com?subject=Hello%20to%20you%21" >me@example.com</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>
|
<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>
|
<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">
|
<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>
|
</script>
|
||||||
]]>
|
]]>
|
||||||
</screen>
|
</programlisting>
|
||||||
</example>
|
</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>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
@@ -160,3 +167,4 @@
|
|||||||
vim: et tw=78 syn=sgml
|
vim: et tw=78 syn=sgml
|
||||||
vi: ts=1 sw=1
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.math">
|
<sect1 id="language.function.math">
|
||||||
<title>math</title>
|
<title>{math}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<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
|
template. Any numeric template variables may be used in the
|
||||||
equations, and the result is printed in place of the tag. The
|
equations, and the result is printed in place of the tag. The
|
||||||
variables used in the equation are passed as parameters, which can
|
variables used in the equation are passed as parameters, which can
|
||||||
@@ -75,15 +75,21 @@
|
|||||||
<note>
|
<note>
|
||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
<para>
|
<para>
|
||||||
math is an expensive function in performance due to its use of
|
{math} is an expensive function in performance due to its use of the php
|
||||||
the php eval() function. Doing the math in PHP is much more
|
<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
|
efficient, so whenever possible do the math calculations in PHP
|
||||||
and assign the results to the template. Definately avoid
|
and <link linkend="api.assign">assign()</link>
|
||||||
repetitive math function calls, like within section loops.
|
the results to the template. Definately avoid
|
||||||
|
repetitive {math} function calls, eg within
|
||||||
|
<link linkend="language.function.section">{section}</link> loops.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<example>
|
<example>
|
||||||
<title>math</title>
|
<title>{math}</title>
|
||||||
|
<para>
|
||||||
|
<emphasis role="bold">Example a:</emphasis>
|
||||||
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{* $height=4, $width=5 *}
|
{* $height=4, $width=5 *}
|
||||||
@@ -99,6 +105,9 @@
|
|||||||
9
|
9
|
||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
|
<para>
|
||||||
|
<emphasis role="bold">Example b:</emphasis>
|
||||||
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{* $row_height = 10, $row_width = 20, #col_div# = 2, assigned in template *}
|
{* $row_height = 10, $row_width = 20, #col_div# = 2, assigned in template *}
|
||||||
@@ -117,6 +126,9 @@
|
|||||||
100
|
100
|
||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
|
<para>
|
||||||
|
<emphasis role="bold">Example c:</emphasis>
|
||||||
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{* you can use parenthesis *}
|
{* you can use parenthesis *}
|
||||||
@@ -132,6 +144,9 @@
|
|||||||
6
|
6
|
||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
|
<para>
|
||||||
|
<emphasis role="bold">Example d:</emphasis>
|
||||||
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{* you can supply a format parameter in sprintf format *}
|
{* you can supply a format parameter in sprintf format *}
|
||||||
|
@@ -1,28 +1,33 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.popup.init">
|
<sect1 id="language.function.popup.init">
|
||||||
<title>popup_init</title>
|
<title>{popup_init}</title>
|
||||||
<para>
|
<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
|
windows. These are used for context sensitive information, such as
|
||||||
help windows or tooltips. popup_init must be called once at the
|
help windows or tooltips.{popup_init} must be called once at the
|
||||||
top of any page you plan on using the <link
|
top of any page you plan on using the
|
||||||
linkend="language.function.popup">popup</link> function. overLib
|
<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
|
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>
|
||||||
<para>
|
<para>
|
||||||
As of Smarty version 2.1.2, overLib does NOT come with the release.
|
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"
|
root and supply the relative path to this file as the "src"
|
||||||
parameter to popup_init.
|
parameter to {popup_init}.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>popup_init</title>
|
<title>popup_init</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
<head>
|
||||||
{* popup_init must be called once at the top of the page *}
|
{* popup_init must be called once at the top of the page *}
|
||||||
{popup_init src="/javascripts/overlib.js"}
|
{popup_init src="/javascripts/overlib.js"}
|
||||||
|
</head>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.popup">
|
<sect1 id="language.function.popup">
|
||||||
<title>popup</title>
|
<title>{popup}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -391,10 +391,12 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<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>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>popup</title>
|
<title>{popup}</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{* popup_init must be called once at the top of the page *}
|
{* 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 *}
|
{* you can use html, links, etc in your popup text *}
|
||||||
<a href="mypage.html" {popup sticky=true caption="mypage contents"
|
<a href="mypage.html" {popup sticky=true caption="mypage contents"
|
||||||
text="<ul><li>links</li><li>pages</li><li>images</li></ul>" snapx=10
|
text="<ul><li>links</li><li>pages</li><li>images</li></ul>"
|
||||||
snapy=10}>mypage</a>
|
snapx=10 snapy=10}>mypage</a>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="language.function.popup.init">{popup_init}</link>
|
||||||
|
and
|
||||||
|
<ulink url="&url.overLib;">overLib</ulink>.
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
@@ -431,3 +439,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
|||||||
vim: et tw=78 syn=sgml
|
vim: et tw=78 syn=sgml
|
||||||
vi: ts=1 sw=1
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.function.textformat">
|
<sect1 id="language.function.textformat">
|
||||||
<title>textformat</title>
|
<title>{textformat}</title>
|
||||||
<informaltable frame="all">
|
<informaltable frame="all">
|
||||||
<tgroup cols="5">
|
<tgroup cols="5">
|
||||||
<colspec colname="param" align="center" />
|
<colspec colname="param" align="center" />
|
||||||
@@ -82,7 +82,9 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<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
|
cleans up spaces and special characters, and formats paragraphs by
|
||||||
wrapping at a boundary and indenting lines.
|
wrapping at a boundary and indenting lines.
|
||||||
</para>
|
</para>
|
||||||
@@ -91,7 +93,7 @@
|
|||||||
Currently "email" is the only available style.
|
Currently "email" is the only available style.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>textformat</title>
|
<title>{textformat}</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
{textformat wrap=40}
|
{textformat wrap=40}
|
||||||
@@ -264,6 +266,13 @@
|
|||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="language.function.strip">{strip}</link>
|
||||||
|
and
|
||||||
|
<link linkend="language.modifier.wordwrap">{wordwrap}</link>.
|
||||||
|
</para>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -70,8 +70,8 @@
|
|||||||
<link linkend="plugins.modifiers">modifiers</link>,
|
<link linkend="plugins.modifiers">modifiers</link>,
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
&designers.language-modifiers.language-modifier-cat;
|
|
||||||
&designers.language-modifiers.language-modifier-capitalize;
|
&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-characters;
|
||||||
&designers.language-modifiers.language-modifier-count-paragraphs;
|
&designers.language-modifiers.language-modifier-count-paragraphs;
|
||||||
&designers.language-modifiers.language-modifier-count-sentences;
|
&designers.language-modifiers.language-modifier-count-sentences;
|
||||||
|
@@ -39,15 +39,13 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('articleTitle', 'next x-men film, x3, delayed.');
|
$smarty->assign('articleTitle', 'next x-men film, x3, delayed.');
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
@@ -67,7 +65,8 @@ Next X-Men Film, X3, Delayed.
|
|||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
</example>
|
</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>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
@@ -89,3 +88,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
|||||||
vim: et tw=78 syn=sgml
|
vim: et tw=78 syn=sgml
|
||||||
vi: ts=1 sw=1
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@@ -37,14 +37,14 @@
|
|||||||
<programlisting role="php">
|
<programlisting role="php">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('articleTitle', "Psychics predict world didn't end");
|
$smarty->assign('articleTitle', "Psychics predict world didn't end");
|
||||||
$smarty->display('index.tpl');
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -39,15 +39,13 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('articleTitle', 'Cold Wave Linked to Temperatures.');
|
$smarty->assign('articleTitle', 'Cold Wave Linked to Temperatures.');
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
@@ -68,9 +66,10 @@ Cold Wave Linked to Temperatures.
|
|||||||
</screen>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<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.sentences">count_sentences</link> and
|
||||||
<link linkend="language.modifier.count.words">count_words</link>.
|
<link linkend="language.modifier.count.paragraphs">count_paragraphs</link>.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
@@ -10,15 +10,17 @@
|
|||||||
<programlisting role="php">
|
<programlisting role="php">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('articleTitle', "War Dims Hope for Peace. Child's Death Ruins
|
$smarty->assign('articleTitle',
|
||||||
Couple's Holiday.\n\nMan is Fatally Slain. Death Causes Loneliness, Feeling of Isolation.");
|
"War Dims Hope for Peace. Child's Death Ruins Couple's Holiday.\n\n
|
||||||
$smarty->display('index.tpl');
|
Man is Fatally Slain. Death Causes Loneliness, Feeling of Isolation."
|
||||||
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -11,15 +11,16 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty->assign('articleTitle',
|
||||||
$smarty->assign('articleTitle', 'Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe.');
|
'Two Soviet Ships Collide - One Dies.
|
||||||
$smarty->display('index.tpl');
|
Enraged Cow Injures Farmer with Axe.'
|
||||||
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -11,15 +11,13 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
|
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -53,15 +53,13 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('yesterday', strtotime('-1 day'));
|
$smarty->assign('yesterday', strtotime('-1 day'));
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
@@ -151,7 +149,8 @@ Monday, February 5, 2001
|
|||||||
%n - newline character
|
%n - newline character
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
<listitem><para>
|
<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>
|
</para></listitem>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
%r - time in a.m. and p.m. notation
|
%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
|
%u - weekday as a decimal number [1,7], with 1 representing Monday
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
<listitem><para>
|
<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>
|
</para></listitem>
|
||||||
<listitem><para>
|
<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.
|
year, and with Monday as the first day of the week.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
%w - day of the week as a decimal, Sunday being 0
|
%w - day of the week as a decimal, Sunday being 0
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
<listitem><para>
|
<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>
|
</para></listitem>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
%x - preferred date representation for the current locale without the time
|
%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
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
@@ -41,15 +41,13 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
|
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -44,15 +44,15 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty->assign('articleTitle',
|
||||||
$smarty->assign('articleTitle', "'Stiff Opposition Expected to Casketless Funeral Plan'");
|
"'Stiff Opposition Expected to Casketless Funeral Plan'"
|
||||||
$smarty->display('index.tpl');
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -49,17 +49,18 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty->assign('articleTitle',
|
||||||
$smarty->assign('articleTitle', 'NJ judge to rule on nude beach.
|
'NJ judge to rule on nude beach.
|
||||||
Sun or rain expected today, dark tonight.
|
Sun or rain expected today, dark tonight.
|
||||||
Statistics show that teen pregnancy drops off significantly after 25.');
|
Statistics show that teen pregnancy drops off significantly after 25.'
|
||||||
$smarty->display('index.tpl');
|
);
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -11,15 +11,13 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('articleTitle', 'Two Convicts Evade Noose, Jury Hung.');
|
$smarty->assign('articleTitle', 'Two Convicts Evade Noose, Jury Hung.');
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -13,15 +13,15 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty->assign('articleTitle',
|
||||||
$smarty->assign('articleTitle', "Sun or rain expected\ntoday, dark tonight");
|
"Sun or rain expected\ntoday, dark tonight"
|
||||||
$smarty->display('index.tpl');
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -47,9 +47,7 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('articleTitle', "Infertility unlikely to\nbe passed on, experts say.");
|
$smarty->assign('articleTitle', "Infertility unlikely to\nbe passed on, experts say.");
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
|
@@ -46,15 +46,13 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('articleTitle', "Child's Stool Great for Use in Garden.");
|
$smarty->assign('articleTitle', "Child's Stool Great for Use in Garden.");
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -39,14 +39,14 @@
|
|||||||
<programlisting role="php">
|
<programlisting role="php">
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('articleTitle', 'Something Went Wrong in Jet Crash, Experts Say.');
|
$smarty->assign('articleTitle', 'Something Went Wrong in Jet Crash, Experts Say.');
|
||||||
$smarty->display('index.tpl');
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -40,15 +40,13 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('number', 23.5787446);
|
$smarty->assign('number', 23.5787446);
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
Where index.tpl is:
|
Where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -38,16 +38,16 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty->assign('articleTitle',
|
||||||
$smarty->assign('articleTitle', "Blind Woman Gets <font face=\"helvetica\">New
|
"Blind Woman Gets <font face=\"helvetica\">New
|
||||||
Kidney</font> from Dad she Hasn't Seen in <b>years</b>.");
|
Kidney</font> from Dad she Hasn't Seen in <b>years</b>."
|
||||||
$smarty->display('index.tpl');
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
where index.tpl is:
|
where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
<title>Note</title>
|
<title>Note</title>
|
||||||
<para>
|
<para>
|
||||||
If you want to strip blocks of template text, use the <link
|
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>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
<example>
|
<example>
|
||||||
@@ -27,7 +27,7 @@ $smarty->display('index.tpl');
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
where index.tpl is:
|
where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -60,15 +60,13 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('articleTitle', 'Two Sisters Reunite after Eighteen Years at Checkout Counter.');
|
$smarty->assign('articleTitle', 'Two Sisters Reunite after Eighteen Years at Checkout Counter.');
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
where index.tpl is:
|
where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -11,15 +11,13 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
|
||||||
$smarty->assign('articleTitle', "If Strike isn't Settled Quickly it may Last a While.");
|
$smarty->assign('articleTitle', "If Strike isn't Settled Quickly it may Last a While.");
|
||||||
$smarty->display('index.tpl');
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
where index.tpl is:
|
where template is:
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@@ -46,10 +46,10 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<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
|
an optional second parameter, you can specify a string of text
|
||||||
to wrap the text to the next line (default is carriage return \n).
|
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
|
you want to cut off at the exact character length, pass the optional
|
||||||
third parameter of true. This is equivalent to the PHP <ulink
|
third parameter of true. This is equivalent to the PHP <ulink
|
||||||
url="&url.php-manual;wordwrap">wordwrap()</ulink> function.
|
url="&url.php-manual;wordwrap">wordwrap()</ulink> function.
|
||||||
@@ -60,15 +60,15 @@
|
|||||||
<![CDATA[
|
<![CDATA[
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty->assign('articleTitle',
|
||||||
$smarty->assign('articleTitle', "Blind woman gets new kidney from dad she hasn't seen in years.");
|
"Blind woman gets new kidney from dad she hasn't seen in years."
|
||||||
$smarty->display('index.tpl');
|
);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
<para>
|
<para>
|
||||||
where index.tpl is:
|
where template is
|
||||||
</para>
|
</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
@@ -110,7 +110,9 @@ years.
|
|||||||
</screen>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<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>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
@@ -134,3 +136,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
|||||||
vim: et tw=78 syn=sgml
|
vim: et tw=78 syn=sgml
|
||||||
vi: ts=1 sw=1
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
<!ENTITY ml.general.sub 'smarty-general-subscribe@lists.php.net'>
|
<!ENTITY ml.general.sub 'smarty-general-subscribe@lists.php.net'>
|
||||||
<!ENTITY url.php-accelerator 'http://www.php-accelerator.co.uk'>
|
<!ENTITY url.php-accelerator 'http://www.php-accelerator.co.uk'>
|
||||||
<!ENTITY url.zend 'http://www.zend.com/'>
|
<!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"> -->
|
<!-- to use like <ulink url="&url.php-manual;some_function"> -->
|
||||||
<!ENTITY url.php-manual 'http://php.net/'>
|
<!ENTITY url.php-manual 'http://php.net/'>
|
||||||
|
Reference in New Issue
Block a user