More formatting and cleaning up examples

This commit is contained in:
pete_morgan
2006-09-26 02:02:55 +00:00
parent 1698b7a1e5
commit 0f7046d4d6
18 changed files with 655 additions and 613 deletions

View File

@@ -3,11 +3,10 @@
<sect1 id="language.function.assign">
<title>{assign}</title>
<para>
{assign} is used for assigning template variables
<emphasis role="bold">during the execution
of a template</emphasis>.
<varname>{assign}</varname> is used for assigning template variables
<emphasis role="bold">during the execution of a template</emphasis>.
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -47,7 +46,7 @@
<title>{assign}</title>
<programlisting>
<![CDATA[
{assign var="name" value="Bob"}
{assign var='name' value='Bob'}
The value of $name is {$name}.
]]>
@@ -64,29 +63,31 @@ The value of $name is Bob.
<example>
<title>{assign} with some maths</title>
<para>This complex example must have the variables in backticks</para>
<para>This complex example must have the variables in `backticks`</para>
<programlisting>
<![CDATA[
{assign var=running_total value=`$running_total+$some_array[loop].some_value`}
{assign var=running_total value=`$running_total+$some_array[row].some_value`}
]]>
</programlisting>
</example>
<example>
<title>Accessing {assign} variables from a PHP script.</title>
<title>Accessing {assign} variables from a PHP script</title>
<para>
To access {assign} variables from the php script use
<link linkend="api.get.template.vars">get_template_vars()</link>.
However, the variables are only available after/during template execution
as in the following example
To access <varname>{assign}</varname> variables from a php script use
<link linkend="api.get.template.vars">
<varname>get_template_vars()</varname></link>.
Here's the template that creates the variable <parameter>$foo</parameter>.
</para>
<programlisting>
<![CDATA[
{* index.tpl *}
{assign var="foo" value="Smarty"}
{assign var='foo' value='Smarty'}
]]>
</programlisting>
<para>The template variables are only available after/during template
execution as in the following script.
</para>
<programlisting role="php">
<![CDATA[
<?php
@@ -94,8 +95,8 @@ The value of $name is Bob.
// this will output nothing as the template has not been executed
echo $smarty->get_template_vars('foo');
// fetch the template to a dead variable
$dead = $smarty->fetch('index.tpl');
// fetch the template to a variable
$whole_page = $smarty->fetch('index.tpl');
// this will output 'smarty' as the template has been executed
echo $smarty->get_template_vars('foo');
@@ -117,22 +118,22 @@ echo $smarty->get_template_vars('foo');
</para>
<para>
<link linkend="language.function.capture">{capture}</link>,
<link linkend="language.function.include">{include}</link>,
<link linkend="language.function.include.php">{include_php}</link>,
<link linkend="language.function.insert">{insert}</link>,
<link linkend="language.function.counter">{counter}</link>,
<link linkend="language.function.cycle">{cycle}</link>,
<link linkend="language.function.eval">{eval}</link>,
<link linkend="language.function.fetch">{fetch}</link>,
<link linkend="language.function.math">{math}</link>,
<link linkend="language.function.textformat">{textformat}</link>
<link linkend="language.function.capture"><varname>{capture}</varname></link>,
<link linkend="language.function.include"><varname>{include}</varname></link>,
<link linkend="language.function.include.php"><varname>{include_php}</varname></link>,
<link linkend="language.function.insert"><varname>{insert}</varname></link>,
<link linkend="language.function.counter"><varname>{counter}</varname></link>,
<link linkend="language.function.cycle"><varname>{cycle}</varname></link>,
<link linkend="language.function.eval"><varname>{eval}</varname></link>,
<link linkend="language.function.fetch"><varname>{fetch}</varname></link>,
<link linkend="language.function.math"><varname>{math}</varname></link>,
<link linkend="language.function.textformat"><varname>{textformat}</varname></link>
</para>
<para>
See also <link linkend="api.assign">assign()</link>
See also <link linkend="api.assign"><varname>assign()</varname></link>
and
<link linkend="api.get.template.vars">get_template_vars()</link>.
<link linkend="api.get.template.vars"><varname>get_template_vars()</varname></link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file

View File

@@ -3,19 +3,20 @@
<sect1 id="language.function.counter">
<title>{counter}</title>
<para>
{counter} is used to print out a count. {counter} will remember the
<varname>{counter}</varname> is used to print out a count.
<varname>{counter}</varname> will remember the
count on each iteration. You can adjust the number, the interval
and the direction of the count, as well as determine whether or not
to print the value. You can run multiple counters concurrently by
supplying a unique name for each one. If you do not supply a name,
the name 'default' will be used.
the name <quote>default</quote> will be used.
</para>
<para>
If you supply the special "assign" attribute, the output of the
counter function will be assigned to this template variable instead of
being output to the template.
If you supply the <parameter>assign</parameter> attribute, the output of the
<varname>{counter}</varname> function will be assigned to this template
variable instead of being output to the template.
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -59,13 +60,13 @@
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>up</emphasis></entry>
<entry>the direction to count (up/down)</entry>
<entry>The direction to count (up/down)</entry>
</row>
<row>
<entry>print</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry><emphasis>true</emphasis></entry>
<entry><emphasis>&true;</emphasis></entry>
<entry>Whether or not to print the value</entry>
</row>
<row>
@@ -80,7 +81,7 @@
</informaltable>
<example>
<title>counter</title>
<title>{counter}</title>
<programlisting>
<![CDATA[
{* initialize the count *}

View File

@@ -3,11 +3,11 @@
<sect1 id="language.function.cycle">
<title>{cycle}</title>
<para>
{cycle} is used to cycle though a set of values. This makes it easy
to alternate for example between two or more colors in a table, or cycle
through an array of values.
<varname>{cycle}</varname> is used to alternate a set of values.
This makes it easy to for example, alternate between two or more colors
in a table, or cycle through an array of values.
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -39,20 +39,20 @@
<entry><emphasis>N/A</emphasis></entry>
<entry>The values to cycle through, either a comma
delimited list (see delimiter attribute), or an array
of values.</entry>
of values</entry>
</row>
<row>
<entry>print</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry><emphasis>true</emphasis></entry>
<entry><emphasis>&true;</emphasis></entry>
<entry>Whether to print the value or not</entry>
</row>
<row>
<entry>advance</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry><emphasis>true</emphasis></entry>
<entry><emphasis>&true;</emphasis></entry>
<entry>Whether or not to advance to the next value</entry>
</row>
<row>
@@ -60,46 +60,50 @@
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>,</emphasis></entry>
<entry>The delimiter to use in the values attribute.</entry>
<entry>The delimiter to use in the values attribute</entry>
</row>
<row>
<entry>assign</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>the template variable the output will be assigned
<entry>The template variable the output will be assigned
to</entry>
</row>
<row>
<entry>reset</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry><emphasis>false</emphasis></entry>
<entry><emphasis>&false;</emphasis></entry>
<entry>The cycle will be set to the first value and not advanced</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
You can {cycle} through more than one set of values in your template
by supplying a name attribute. Give each set of values a unique
name.
</para>
<para>
You can force the current value not to print with the print
attribute set to false. This would be useful for silently skipping
a value.
</para>
<para>
The advance attribute is used to repeat a value. When set to false,
the next call to {cycle} will print the same value.
</para>
<para>
If you supply the special "assign" attribute, the output of the
cycle function will be assigned to a template variable instead of
being output to the template.
</para>
<itemizedlist>
<listitem><para>
You can <varname>{cycle}</varname> through more than one set of values in
a template by supplying a <parameter>name</parameter> attribute.
Give each <varname>{cycle}</varname> an unique <parameter>name</parameter>.
</para></listitem>
<listitem><para>
You can force the current value not to print with the
<parameter>print</parameter> attribute set to &false;. This would be useful
for silently skipping a value.
</para></listitem>
<listitem><para>
The <parameter>advance</parameter> attribute is used to repeat a value.
When set to &false;, the next call to <varname>{cycle}</varname> will print
the same value.
</para></listitem>
<listitem><para>
If you supply the <parameter>assign</parameter> attribute, the output of the
<varname>{cycle}</varname> function will be assigned to a template variable
instead of being output to the template.
</para></listitem>
</itemizedlist>
<example>
<title>{cycle}</title>
<programlisting>
@@ -111,6 +115,7 @@
{/section}
]]>
</programlisting>
<para>The above template would output:</para>
<screen>
<![CDATA[
<tr bgcolor="#eeeeee">

View File

@@ -2,6 +2,16 @@
<!-- $Revision$ -->
<sect1 id="language.function.debug">
<title>{debug}</title>
<para>
<varname>{debug}</varname> dumps the debug console to the page. This works
regardless of the <link linkend="chapter.debugging.console">debug</link>
settings in the php script. Since this gets executed at runtime, this is
only able to show the <link linkend="api.assign">assigned</link>
variables; not the templates that
are in use. However, you can see all the currently available variables
within the scope of a template.
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -29,17 +39,10 @@
</tbody>
</tgroup>
</informaltable>
<para>
{debug} dumps the debug console to the page. This works regardless
of the <link linkend="chapter.debugging.console">debug</link>
settings in Smarty. Since this gets executed at runtime, this is
only able to show the <link linkend="api.assign">assigned</link>
variables, not the templates that
are in use. But, you see all the currently available variables
within the scope of this template.
</para>
<para>
See also <link linkend="chapter.debugging.console">Debugging console</link>
See also the
<link linkend="chapter.debugging.console">debugging console page</link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file

View File

@@ -3,16 +3,16 @@
<sect1 id="language.function.eval">
<title>{eval}</title>
<para>
{eval} is used to evaluate a variable as a template. This can be used
for things like embedding template tags/variables into variables or
tags/variables into config file variables.
<varname>{eval}</varname> is used to evaluate a variable as a template.
This can be used for things like embedding template tags/variables into
variables or tags/variables into config file variables.
</para>
<para>
If you supply the special "assign" attribute, the output of the
{eval} function will be assigned to this template variable instead of
being output to the template.
If you supply the <parameter>assign</parameter> attribute, the output of the
<varname>{eval}</varname> function will be assigned to this template
variable instead of being output to the template.
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -35,14 +35,14 @@
<entry>mixed</entry>
<entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>variable (or string) to evaluate</entry>
<entry>Variable (or string) to evaluate</entry>
</row>
<row>
<entry>assign</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>the template variable the output will be assigned
<entry>The template variable the output will be assigned
to</entry>
</row>
</tbody>
@@ -52,28 +52,28 @@
<note>
<title>Technical Note</title>
<para>
<itemizedlist>
<listitem><para>
Evaluated variables are treated the same as templates. They follow
the same escapement and security features just as if they were
templates.
</para>
</note>
<note>
<title>Technical Note</title>
<para>
</para></listitem>
<listitem><para>
Evaluated variables are compiled on every invocation, the compiled
versions are not saved! However if you have
<link linkend="caching">caching</link>
enabled, the
<link linkend="caching">caching</link> enabled, the
output will be cached with the rest of the template.
</para></listitem>
</itemizedlist>
</para>
</note>
<example>
<title>{eval}</title>
<para>The contents of the config file, <filename>setup.conf</filename>.</para>
<programlisting>
<![CDATA[
#setup.conf
#----------
emphstart = <strong>
emphend = </strong>
title = Welcome to {$company}'s home page!
@@ -96,7 +96,7 @@ ErrorState = You must supply a {#emphstart#}state{#emphend#}.
]]>
</programlisting>
<para>
The above example will output:
The above template will output:
</para>
<screen>
<![CDATA[
@@ -107,17 +107,18 @@ You must supply a <strong>state</strong>.
]]>
</screen>
</example>
<example>
<title>another {eval} example</title>
<para>This outputs the server name (in uppercase) and IP.
The variable $str could be from a database query also.</para>
<title>Another {eval} example</title>
<para>This outputs the server name (in uppercase) and IP. The assigned
variable <parameter>$str</parameter> could be from a database query.</para>
<programlisting role="php">
<![CDATA[
// php script
<?php
$str = 'The server name is {$smarty.server.SERVER_NAME|upper} '
.'at {$smarty.server.SERVER_ADDR}';
$smarty->assign('foo',$str);
?>
]]>
</programlisting>
<para>
@@ -129,8 +130,8 @@ $smarty->assign('foo',$str);
]]>
</programlisting>
</example>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:

View File

@@ -3,19 +3,49 @@
<sect1 id="language.function.fetch">
<title>{fetch}</title>
<para>
{fetch} is used to fetch files from the local file system, http, or
ftp and display the contents. If the file name begins with
"http://", the web site page will be fetched and displayed. If the
file name begins with "ftp://", the file will be fetched from the
ftp server and displayed. For local files, the full system file
path must be given, or a path relative to the executed php script.
</para>
<para>
If you supply the special "assign" attribute, the output of the
{fetch} function will be assigned to this template variable instead of
being output to the template.
</para>
<varname>{fetch}</varname> is used to retrieve files from the
local file system, http, or ftp and display the contents.
</para>
<itemizedlist>
<listitem><para>
If the file name begins with
<parameter>http://</parameter>, the web site page will be fetched and displayed.
<note>
<para>
This will not support http redirects, be sure to
include a trailing slash on your web page fetches where necessary.
</para>
</note>
</para></listitem>
<listitem><para>
If the file name begins with <parameter>ftp://</parameter>, the file will
be downloaded from the ftp server and displayed.
</para></listitem>
<listitem><para>
For local files, either a full system file path
must be given, or a path relative to the executed php script.
<note>
<para>
If template <link linkend="variable.security">
<parameter>$security</parameter></link>
is enabled and you are
fetching a file from the local file system, <varname>{fetch}</varname>
will only allow files from within one of the defined
<link linkend="variable.secure.dir">secure directories</link>.
</para>
</note>
</para></listitem>
<listitem><para>
If the <parameter>assign</parameter> attribute is set, the output of the
<varname>{fetch}</varname> function will be assigned to this template
variable instead of being output to the template.
</para></listitem>
</itemizedlist>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -38,37 +68,21 @@
<entry>string</entry>
<entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>the file, http or ftp site to fetch</entry>
<entry>The file, http or ftp site to fetch</entry>
</row>
<row>
<entry>assign</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>the template variable the output will be assigned
<entry>The template variable the output will be assigned
to</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<note>
<title>Technical Note</title>
<para>
This will not support http redirects, be sure to
include a trailing slash on your web page fetches where necessary.
</para>
</note>
<note>
<title>Technical Note</title>
<para>
If template <link linkend="variable.security">$security</link>
is enabled and you are
fetching a file from the local file system, {fetch} will only allow
files from within one of the defined
<link linkend="variable.secure.dir">secure directories</link>.
</para>
</note>
<example>
<title>{fetch} examples</title>
<programlisting>
@@ -94,11 +108,11 @@
</example>
<para>
See also
<link linkend="language.function.capture">{capture}</link>,
<link linkend="language.function.eval">{eval}</link>,
<link linkend="language.function.assign">{assign}</link>
<link linkend="language.function.capture"><varname>{capture}</varname></link>,
<link linkend="language.function.eval"><varname>{eval}</varname></link>,
<link linkend="language.function.assign"><varname>{assign}</varname></link>
and
<link linkend="api.fetch">fetch()</link>.
<link linkend="api.fetch"><varname>fetch()</varname></link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file

View File

@@ -3,15 +3,13 @@
<sect1 id="language.function.html.checkboxes">
<title>{html_checkboxes}</title>
<para>
{html_checkboxes} is a
<varname>{html_checkboxes}</varname> is a
<link linkend="language.custom.functions">custom function</link>
that creates an html checkbox
group with provided data. It takes care of which item(s) are
selected by default as well. Required attributes are values and
output, unless you use options instead. All output is XHTML
compliant.
</para>
selected by default as well.
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -34,73 +32,86 @@
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>checkbox</emphasis></entry>
<entry>name of checkbox list</entry>
<entry>Name of checkbox list</entry>
</row>
<row>
<entry>values</entry>
<entry>array</entry>
<entry>Yes, unless using options attribute</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>an array of values for checkbox buttons</entry>
<entry>An array of values for checkbox buttons</entry>
</row>
<row>
<entry>output</entry>
<entry>array</entry>
<entry>Yes, unless using options attribute</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>an array of output for checkbox buttons</entry>
<entry>An array of output for checkbox buttons</entry>
</row>
<row>
<entry>selected</entry>
<entry>string/array</entry>
<entry>No</entry>
<entry><emphasis>empty</emphasis></entry>
<entry>the selected checkbox element(s)</entry>
<entry>The selected checkbox element(s)</entry>
</row>
<row>
<entry>options</entry>
<entry>associative array</entry>
<entry>Yes, unless using values and output</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>an associative array of values and output</entry>
<entry>An associative array of values and output</entry>
</row>
<row>
<entry>separator</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>empty</emphasis></entry>
<entry>string of text to separate each checkbox item</entry>
<entry>String of text to separate each checkbox item</entry>
</row>
<row>
<entry>assign</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>empty</emphasis></entry>
<entry>assign checkbox tags to an array instead of output</entry>
<entry>Assign checkbox tags to an array instead of output</entry>
</row>
<row>
<entry>labels</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry><emphasis>true</emphasis></entry>
<entry>add &lt;label&gt;-tags to the output</entry>
<entry><emphasis>&true;</emphasis></entry>
<entry>Add &lt;label&gt;-tags to the output</entry>
</row>
<row>
<entry>assign</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>empty</emphasis></entry>
<entry>assign the output to an array with each checkbox's output
<entry>Assign the output to an array with each checkbox's output
as one element.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
All parameters that are not in the list above are printed as
<itemizedlist>
<listitem><para>
Required attributes are <parameter>values</parameter> and
<parameter>output</parameter>, unless you use <parameter>options</parameter>
instead.
</para></listitem>
<listitem><para>
All output is XHTML compliant.
</para></listitem>
<listitem><para>
All parameters that are not in the list above are printed as
name/value-pairs inside each of the created &lt;input&gt;-tags.
</para>
</para></listitem>
</itemizedlist>
<example>
<title>{html_checkboxes}</title>
<programlisting role="php">
@@ -151,7 +162,7 @@ $smarty->assign('customer_id', 1001);
</para>
<programlisting>
<![CDATA[
{html_checkboxes name='id' options=$cust_checkboxes
{html_checkboxes name='id' options=$cust_checkboxes
selected=$customer_id separator='<br />'}
]]>
</programlisting>
@@ -186,18 +197,19 @@ $smarty->assign('contact',$db->getRow($sql));
?>
]]>
</programlisting>
<para>The results of the database queries above would be output with.</para>
<programlisting>
<![CDATA[
{html_checkboxes name='contact_type_id' options=$contact_types
{html_checkboxes name='contact_type_id' options=$contact_types
selected=$contact.contact_type_id separator='<br />'}
]]>
</programlisting>
</example>
<para>
See also
<link linkend="language.function.html.radios">{html_radios}</link>
<link linkend="language.function.html.radios"><varname>{html_radios}</varname></link>
and
<link linkend="language.function.html.options">{html_options}</link>
<link linkend="language.function.html.options"><varname>{html_options}</varname></link>
</para>
</sect1>
<!-- Keep this comment at the end of the file

View File

@@ -3,13 +3,13 @@
<sect1 id="language.function.html.image">
<title>{html_image}</title>
<para>
{html_image} is a
<varname>{html_image}</varname> is a
<link linkend="language.custom.functions">custom function</link>
that generates an HTML tag for an
image. The height and width are automatically calculated from the
image file if none are supplied.
that generates a HTML &lt;img&gt; tag.
The <parameter>height</parameter> and <parameter>width</parameter>
are automatically calculated from the image file if they are not supplied.
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -39,28 +39,28 @@
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>actual image height</emphasis></entry>
<entry>height to display image</entry>
<entry>Height to display image</entry>
</row>
<row>
<entry>width</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>actual image width</emphasis></entry>
<entry>width to display image</entry>
<entry>Width to display image</entry>
</row>
<row>
<entry>basedir</entry>
<entry>string</entry>
<entry>no</entry>
<entry><emphasis>web server doc root</emphasis></entry>
<entry>directory to base relative paths from</entry>
<entry>Directory to base relative paths from</entry>
</row>
<row>
<entry>alt</entry>
<entry>string</entry>
<entry>no</entry>
<entry><emphasis>""</emphasis></entry>
<entry>alternative description of the image</entry>
<entry><emphasis><quote></quote></emphasis></entry>
<entry>Alternative description of the image</entry>
</row>
<row>
<entry>href</entry>
@@ -74,56 +74,62 @@
<entry>string</entry>
<entry>no</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>prefix for output path</entry>
<entry>Prefix for output path</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
basedir is the base directory that relative image paths are based
from. If not given, the web server document root (
<link linkend="language.variables.smarty">env</link>
variable DOCUMENT_ROOT) is used as the base. If
<link linkend="variable.security">$security</link>
is enabled, the
path to the image must be within a secure directory.
</para>
<para>
<parameter>href</parameter> is the href value to link the image to. If link is supplied, an
&lt;a href="LINKVALUE"&gt;&lt;a&gt; tag is placed around the image tag.
</para>
<para>
<parameter>path_prefix</parameter> is an optional prefix string you can give the output path.
<itemizedlist>
<listitem><para>
<parameter>basedir</parameter> is the base directory that relative image
paths are based from. If not given, the web server's document root
<varname>$_ENV['DOCUMENT_ROOT']</varname> is used as the base.
If <link linkend="variable.security"><parameter>$security</parameter></link>
is enabled, the path to the image must be within a
<link linkend="variable.secure.dir">secure directory</link>.
</para></listitem>
<listitem><para>
<parameter>href</parameter> is the href value to link the image to.
If link is supplied, an &lt;a href="LINKVALUE"&gt;&lt;a&gt; tag is placed
around the image tag.
</para> </listitem>
<listitem><para>
<parameter>path_prefix</parameter> is an optional prefix string you can give
the output path.
This is useful if you want to supply a different server name for the image.
</para>
<para>
</para></listitem>
<listitem><para>
All parameters that are not in the list above are printed as
name/value-pairs inside the created &lt;img&gt; tag.
</para>
</para></listitem>
</itemizedlist>
<note>
<title>Technical Note</title>
<para>
{html_image} requires a hit to the disk to read the image and
calculate the height and width. If you don't use template
<varname>{html_image}</varname> requires a hit to the disk to read the
image and calculate the height and width. If you don't use template
<link linkend="caching">caching</link>,
it is generally better to avoid {html_image} and leave
it is generally better to avoid <varname>{html_image}</varname> and leave
image tags static for optimal performance.
</para>
</note>
<example>
<title>html_image example</title>
<title>{html_image} example</title>
<programlisting>
<![CDATA[
where index.tpl is:
-------------------
{html_image file='pumpkin.jpg'}
{html_image file='/path/from/docroot/pumpkin.jpg'}
{html_image file='../path/relative/to/currdir/pumpkin.jpg'}
]]>
</programlisting>
<para>
possible output would be:
Example output of the above template would be:
</para>
<screen>
<![CDATA[
@@ -133,6 +139,7 @@ where index.tpl is:
]]>
</screen>
</example>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:

View File

@@ -3,14 +3,13 @@
<sect1 id="language.function.html.options">
<title>{html_options}</title>
<para>
{html_options} is a
<varname>{html_options}</varname> is a
<link linkend="language.custom.functions">custom function</link>
that creates html &lt;select&gt;&lt;option&gt; group
with provided data. It takes care of which item(s) are selected by
default as well. Required attributes are values and output, unless
you use options instead.
</para>
that creates a html &lt;select&gt;&lt;option&gt; group
with the assigned data. It takes care of which item(s) are selected by
default as well.
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -67,94 +66,119 @@
</tgroup>
</informaltable>
<para>
<itemizedlist>
<listitem><para>
Required attributes are
<parameter>values</parameter> and <parameter>output</parameter>,
unless you use the combined <parameter>options</parameter> instead.
</para></listitem>
<listitem><para>
If the optional <parameter>name</parameter> attribute is given, the
&lt;select&gt;&lt;/select&gt; tags are created,
otherwise ONLY the &lt;option&gt;'s list are generated.
</para></listitem>
<listitem><para>
If a given value is an array, it will treat it as an html &lt;optgroup&gt;,
and display the groups. Recursion is supported with &lt;optgroup&gt;. All
output is XHTML compatible.
</para>
<para>
If the optional <emphasis>name</emphasis> attribute is given, the
&lt;select name="groupname"&gt;&lt;/select&gt; tags will enclose
the option list. Otherwise only the &lt;option&gt; list is generated.
</para>
<para>
and display the groups. Recursion is supported with &lt;optgroup&gt;.
</para></listitem>
<listitem><para>
All parameters that are not in the list above are printed as
name/value-pairs inside the &lt;select&gt; tag. They are ignored if
the optional <emphasis>name</emphasis> is not given.
</para>
the optional <parameter>name</parameter> is not given.
</para></listitem>
<listitem><para>
All output is XHTML compliant.
</para></listitem>
</itemizedlist>
<example>
<title>{html_options}</title>
<para>
<emphasis role="bold">Example 1:</emphasis>
</para>
<title>Associative array with the <varname>options</varname> attribute</title>
<programlisting role="php">
<![CDATA[
<?php
$smarty->assign('myOptions', array(
1800 => 'Joe Schmoe',
9904 => 'Jack Smith',
2003 => 'Charlie Brown')
);
$smarty->assign('mySelect', 9904);
?>
]]>
</programlisting>
<para>
The following template will generate a drop-down list.
Note the presence of the <parameter>name</parameter> attribute
which creates the &lt;select&gt; tags.
</para>
<programlisting>
<![CDATA[
{html_options name=foo options=$myOptions selected=$mySelect}
]]>
</programlisting>
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
<para>
Output of the above example would be:
</para>
<screen>
<![CDATA[
<select name="foo">
<option label="Joe Schmoe" value="1800">Joe Schmoe</option>
<option label="Jack Smith" value="9904" selected="selected">Jack Smith</option>
<option label="Charlie Brown" value="2003">Charlie Brown</option>
</select>
]]>
</screen>
</example>
<example>
<title>Dropdown with seperate arrays for ouptut.</title>
<programlisting role="php">
<![CDATA[
<?php
$smarty->assign('cust_ids', array(56,92,13));
$smarty->assign('cust_names', array(
'Joe Schmoe',
'Jack Smith',
'Jane Johnson',
'Charlie Brown'));
$smarty->assign('customer_id', 1001);
$smarty->assign('customer_id', 92);
?>
]]>
</programlisting>
<para>
Where template is:
The above arrays would be output with the following template.
Note the sneaky use of the php <ulink url="&url.php-manual;function.count">
<varname>count()</varname></ulink> function as a modifier
to set the select size.
</para>
<programlisting>
<![CDATA[
<select name="customer_id">
<select name="customer_id" size="{$cust_names|@count}">
{html_options values=$cust_ids output=$cust_names selected=$customer_id}
</select>
]]>
</programlisting>
<para>
<emphasis role="bold">Example 2:</emphasis>
</para>
<programlisting role="php">
<![CDATA[
<?php
$smarty->assign('cust_options', array(
1000 => 'Joe Schmoe',
1001 => 'Jack Smith',
1002 => 'Jane Johnson',
1003 => 'Charlie Brown')
);
$smarty->assign('customer_id', 1001);
?>
]]>
</programlisting>
<para>
where template is:
</para>
<programlisting>
<![CDATA[
{html_options name=customer_id options=$cust_options selected=$customer_id}
]]>
</programlisting>
<para>
Both the above examples will output:
The above example would output:
</para>
<screen>
<![CDATA[
<select name="customer_id">
<option label="Joe Schmoe" value="1000">Joe Schmoe</option>
<option label="Jack Smith" value="1001" selected="selected">Jack Smith</option>
<option label="Jane Johnson" value="1002">Jane Johnson</option>
<option label="Charlie Brown" value="1003">Charlie Brown</option>
<option label="Joe Schmoe" value="56">Joe Schmoe</option>
<option label="Jack Smith" value="92" selected="selected">Jane Johnson</option>
<option label="Charlie Brown" value="13">Charlie Brown</option>
</select>
]]>
</screen>
</example>
<example>
<title>{html_options} - Database example (eg PEAR or ADODB):</title>
<title>Database example (eg ADODB or PEAR)</title>
<programlisting role="php">
<![CDATA[
<?php
@@ -170,7 +194,7 @@ $smarty->assign('contact',$db->getRow($sql));
]]>
</programlisting>
<para>
where the template is:
where an example template would be
</para>
<programlisting>
<![CDATA[
@@ -181,11 +205,53 @@ where the template is:
]]>
</programlisting>
</example>
<example>
<title>Dropdown's with &lt;optgroup&gt; </title>
<programlisting role="php">
<![CDATA[
<?php
$arr['Sport'] = array(6 => 'Golf', 9 => 'Cricket',7 => 'Swim');
$arr['Rest'] = array(3 => 'Sauna',1 => 'Massage');
$smarty->assign('lookups', $arr);
$smarty->assign('fav', 7);
?>
]]>
</programlisting>
<para>With the template would be
</para>
<programlisting>
<![CDATA[
{html_options name=foo options=$myOptions selected=$mySelect}
]]>
</programlisting>
<para>
Output of the above example would be:
</para>
<screen>
<![CDATA[
<select name="breakTime">
<optgroup label="Sport">
<option label="Golf" value="6">Golf</option>
<option label="Cricket" value="9">Cricket</option>
<option label="Swim" value="7" selected="selected">Swim</option>
</optgroup>
<optgroup label="Rest">
<option label="Sauna" value="3">Sauna</option>
<option label="Massage" value="1">Massage</option>
</optgroup>
</select>
]]>
</screen>
</example>
<para>
See also
<link linkend="language.function.html.checkboxes">{html_checkboxes}</link>
<link linkend="language.function.html.checkboxes"><varname>{html_checkboxes}</varname></link>
and
<link linkend="language.function.html.radios">{html_radios}</link>
<link linkend="language.function.html.radios"><varname>{html_radios}</varname></link>
</para>
</sect1>

View File

@@ -3,14 +3,13 @@
<sect1 id="language.function.html.radios">
<title>{html_radios}</title>
<para>
{html_radios} is a
<varname>{html_radios}</varname> is a
<link linkend="language.custom.functions">custom function</link>
that creates html radio button
group with provided data. It takes care of which item is selected
by default as well. Required attributes are values and output,
unless you use options instead. All output is XHTML compliant.
</para>
that creates html radio button group.
It takes care of which item is selected by default as well.
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -81,13 +80,24 @@
</tgroup>
</informaltable>
<para>
All parameters that are not in the list above are printed as
name/value-pairs inside each of the created &lt;input&gt;-tags.
</para>
<itemizedlist>
<listitem><para>
Required attributes are <parameter>values</parameter> and
<parameter>output</parameter>, unless you use <parameter>options</parameter>
instead.
</para></listitem>
<listitem><para>
All output is XHTML compliant.
</para></listitem>
<listitem><para>
All parameters that are not in the list above are printed as
name/value-pairs inside each of the created &lt;input&gt;-tags.
</para></listitem>
</itemizedlist>
<example>
<title>{html_radios} example 1</title>
<title>{html_radios} first example</title>
<programlisting role="php">
<![CDATA[
<?php
@@ -115,7 +125,7 @@ $smarty->assign('customer_id', 1001);
</programlisting>
</example>
<example>
<title>{html_radios} example 2</title>
<title>{html_radios} second example</title>
<programlisting role="php">
<![CDATA[
<?php
@@ -135,7 +145,7 @@ $smarty->assign('customer_id', 1001);
</para>
<programlisting>
<![CDATA[
{html_radios name='id' options=$cust_radios
{html_radios name='id' options=$cust_radios
selected=$customer_id separator='<br />'}
]]>
</programlisting>
@@ -169,20 +179,21 @@ $smarty->assign('contact',$db->getRow($sql));
]]>
</programlisting>
<para>
and the template:
The variable assigned from the database above
would be output with the template:
</para>
<programlisting>
<![CDATA[
{html_radios name='contact_type_id' options=$contact_types
{html_radios name='contact_type_id' options=$contact_types
selected=$contact.contact_type_id separator='<br />'}
]]>
</programlisting>
</example>
<para>
See also <link
linkend="language.function.html.checkboxes">{html_checkboxes}</link>
linkend="language.function.html.checkboxes"><varname>{html_checkboxes}</varname></link>
and <link
linkend="language.function.html.options">{html_options}</link>
linkend="language.function.html.options"><varname>{html_options}</varname></link>
</para>
</sect1>
<!-- Keep this comment at the end of the file

View File

@@ -3,12 +3,14 @@
<sect1 id="language.function.html.select.date">
<title>{html_select_date}</title>
<para>
{html_select_date} is a
<varname>{html_select_date}</varname> 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.
that creates date dropdowns.
It can display any or all of year, month, and day.
All parameters that are not in the list below are printed as
name/value-pairs inside the &lt;select&gt; tags of day, month and year.
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -60,21 +62,21 @@
<entry>display_days</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry>true</entry>
<entry>&true;</entry>
<entry>whether to display days or not</entry>
</row>
<row>
<entry>display_months</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry>true</entry>
<entry>&true;</entry>
<entry>whether to display months or not</entry>
</row>
<row>
<entry>display_years</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry>true</entry>
<entry>&true;</entry>
<entry>whether to display years or not</entry>
</row>
<row>
@@ -102,14 +104,14 @@
<entry>year_as_text</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry>false</entry>
<entry>&false;</entry>
<entry>whether or not to display the year as text</entry>
</row>
<row>
<entry>reverse_years</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry>false</entry>
<entry>&false;</entry>
<entry>display years in reverse order</entry>
</row>
<row>
@@ -200,9 +202,9 @@
<entry>No</entry>
<entry>null</entry>
<entry>If supplied then the first element of the year's select-box has this
value as it's label and "" as it's value. This is useful to make the
select-box read "Please select a year" for example.
Note that you can use values like "-MM-DD" as time-attribute to indicate
value as it's label and <quote></quote> as it's value. This is useful to make the
select-box read <quote>Please select a year</quote> for example.
Note that you can use values like <quote>-MM-DD</quote> as time-attribute to indicate
an unselected year.</entry>
</row>
<row>
@@ -211,8 +213,8 @@
<entry>No</entry>
<entry>null</entry>
<entry>If supplied then the first element of the month's select-box has this
value as it's label and "" as it's value. .
Note that you can use values like "YYYY--DD" as time-attribute to indicate
value as it's label and <quote></quote> as it's value. .
Note that you can use values like <quote>YYYY--DD</quote> as time-attribute to indicate
an unselected month.</entry>
</row>
<row>
@@ -221,18 +223,22 @@
<entry>No</entry>
<entry>null</entry>
<entry>If supplied then the first element of the day's select-box has this
value as it's label and "" as it's value.
Note that you can use values like "YYYY-MM-" as time-attribute to indicate
an unselected day.</entry>
value as it's label and <quote></quote> as it's value.
Note that you can use values like <quote>YYYY-MM-</quote> as
time-attribute to indicate an unselected day.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
All parameters that are not in the list above are printed as
name/value-pairs inside the &lt;select&gt; tags of day, month and
year.
</para>
<note>
<para>
There's an useful php function on the
<link linkend="tips.dates">date tips page</link> for converting
<varname>{html_select_date}</varname> values to a timestamp.
</para>
</note>
<example>
<title>{html_select_date}</title>
<para>Template code</para>
@@ -278,7 +284,7 @@
</example>
<example>
<title>{html_select_date}</title>
<title>{html_select_date} second example</title>
<programlisting>
<![CDATA[
{* start and end year can be relative to current year *}
@@ -287,29 +293,20 @@
]]>
</programlisting>
<para>
This will output: (current year is 2000)
With 2000 as the current year the output:
</para>
<screen>
<![CDATA[
<select name="StartDateMonth">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
.... snipped ....
<option value="11">November</option>
<option value="12" selected="selected">December</option>
</select>
<select name="StartDateYear">
<option value="1995">1995</option>
<option value="1996">1996</option>
<option value="1997">1997</option>
<option value="1998">1998</option>
.... snipped ....
<option value="1999">1999</option>
<option value="2000" selected="selected">2000</option>
<option value="2001">2001</option>
@@ -318,10 +315,11 @@
</screen>
</example>
<para>
See also <link linkend="language.function.html.select.time">{html_select_time}</link>,
<link linkend="language.modifier.date.format">date_format</link>,
<link linkend="language.variables.smarty.now">$smarty.now</link>
and <link linkend="tips.dates">date tips</link>.
See also
<link linkend="language.function.html.select.time"><varname>{html_select_time}</varname></link>,
<link linkend="language.modifier.date.format"><varname>date_format</varname></link>,
<link linkend="language.variables.smarty.now"><parameter>$smarty.now</parameter></link>
and the <link linkend="tips.dates">date tips page</link>.
</para>
</sect1>

View File

@@ -3,12 +3,18 @@
<sect1 id="language.function.html.select.time">
<title>{html_select_time}</title>
<para>
{html_select_time} is a
<varname>{html_select_time}</varname> is a
<link linkend="language.custom.functions">custom function</link>
that creates time dropdowns for you. It can display
any or all of hour, minute, second and meridian.
that creates time dropdowns for you.
It can display any or all of hour, minute, second and meridian.
</para>
<para>
The <parameter>time</parameter> attribute can have different formats.
It can be a unique timestamp, a string of the format YYYYMMDDHHMMSS
or a string that is parseable by php's
<ulink url="&url.php-manual;strtotime"><varname>strtotime()</varname></ulink>.
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -31,85 +37,84 @@
<entry>string</entry>
<entry>No</entry>
<entry>Time_</entry>
<entry>what to prefix the var name with</entry>
<entry>What to prefix the var name with</entry>
</row>
<row>
<entry>time</entry>
<entry>timestamp</entry>
<entry>No</entry>
<entry>current time</entry>
<entry>what date/time to use</entry>
<entry>What date/time to use</entry>
</row>
<row>
<entry>display_hours</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry>true</entry>
<entry>whether or not to display hours</entry>
<entry>&true;</entry>
<entry>Whether or not to display hours</entry>
</row>
<row>
<entry>display_minutes</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry>true</entry>
<entry>whether or not to display minutes</entry>
<entry>&true;</entry>
<entry>Whether or not to display minutes</entry>
</row>
<row>
<entry>display_seconds</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry>true</entry>
<entry>whether or not to display seconds</entry>
<entry>&true;</entry>
<entry>Whether or not to display seconds</entry>
</row>
<row>
<entry>display_meridian</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry>true</entry>
<entry>whether or not to display meridian (am/pm)</entry>
<entry>&true;</entry>
<entry>Whether or not to display meridian (am/pm)</entry>
</row>
<row>
<entry>use_24_hours</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry>true</entry>
<entry>whether or not to use 24 hour clock</entry>
<entry>&true;</entry>
<entry>Whether or not to use 24 hour clock</entry>
</row>
<row>
<entry>minute_interval</entry>
<entry>integer</entry>
<entry>No</entry>
<entry>1</entry>
<entry>number interval in minute dropdown</entry>
<entry>Number interval in minute dropdown</entry>
</row>
<row>
<entry>second_interval</entry>
<entry>integer</entry>
<entry>No</entry>
<entry>1</entry>
<entry>number interval in second dropdown</entry>
<entry>Number interval in second dropdown</entry>
</row>
<row>
<entry>field_array</entry>
<entry>string</entry>
<entry>No</entry>
<entry>n/a</entry>
<entry>outputs values to array of this name</entry>
<entry>Outputs values to array of this name</entry>
</row>
<row>
<entry>all_extra</entry>
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>adds extra attributes to select/input tags if
given</entry>
<entry>Adds extra attributes to select/input tags if given</entry>
</row>
<row>
<entry>hour_extra</entry>
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>adds extra attributes to select/input tags if
<entry>Adds extra attributes to select/input tags if
given</entry>
</row>
<row>
@@ -117,7 +122,7 @@
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>adds extra attributes to select/input tags if
<entry>Adds extra attributes to select/input tags if
given</entry>
</row>
<row>
@@ -125,7 +130,7 @@
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>adds extra attributes to select/input tags if
<entry>Adds extra attributes to select/input tags if
given</entry>
</row>
<row>
@@ -133,181 +138,55 @@
<entry>string</entry>
<entry>No</entry>
<entry>null</entry>
<entry>adds extra attributes to select/input tags if
<entry>Adds extra attributes to select/input tags if
given</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
The time-attribute can have different
formats. It can be a unique timestamp, a
string of the format YYYYMMDDHHMMSS or a string
that is parseable by php's
<ulink url="&url.php-manual;strtotime">strtotime()</ulink>.
</para>
<example>
<title>{html_select_time}</title>
<programlisting>
<![CDATA[
template code:
--------------
{html_select_time use_24_hours=true}
]]>
</programlisting>
<para>
This will output:
At 9:20 and 23 seconds in the morning the template above would output:
</para>
<screen>
<![CDATA[
<select name="Time_Hour">
<option value="00">00</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
... snipped ....
<option value="08">08</option>
<option value="09" selected>09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
... snipped ....
<option value="22">22</option>
<option value="23">23</option>
</select>
<select name="Time_Minute">
<option value="00">00</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
... snipped ....
<option value="19">19</option>
<option value="20" selected>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="30">30</option>
<option value="31">31</option>
<option value="32">32</option>
<option value="33">33</option>
<option value="34">34</option>
<option value="35">35</option>
<option value="36">36</option>
<option value="37">37</option>
<option value="38">38</option>
<option value="39">39</option>
<option value="40">40</option>
<option value="41">41</option>
<option value="42">42</option>
<option value="43">43</option>
<option value="44">44</option>
<option value="45">45</option>
<option value="46">46</option>
<option value="47">47</option>
<option value="48">48</option>
<option value="49">49</option>
<option value="50">50</option>
<option value="51">51</option>
<option value="52">52</option>
<option value="53">53</option>
<option value="54">54</option>
<option value="55">55</option>
<option value="56">56</option>
<option value="57">57</option>
... snipped ....
<option value="58">58</option>
<option value="59">59</option>
</select>
<select name="Time_Second">
<option value="00">00</option>
<option value="01">01</option>
<option value="02">02</option>
<option value="03">03</option>
<option value="04">04</option>
<option value="05">05</option>
<option value="06">06</option>
<option value="07">07</option>
<option value="08">08</option>
<option value="09">09</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
... snipped ....
<option value="22">22</option>
<option value="23" selected>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="30">30</option>
<option value="31">31</option>
<option value="32">32</option>
<option value="33">33</option>
<option value="34">34</option>
<option value="35">35</option>
<option value="36">36</option>
<option value="37">37</option>
<option value="38">38</option>
<option value="39">39</option>
<option value="40">40</option>
<option value="41">41</option>
<option value="42">42</option>
<option value="43">43</option>
<option value="44">44</option>
<option value="45">45</option>
<option value="46">46</option>
<option value="47">47</option>
<option value="48">48</option>
<option value="49">49</option>
<option value="50">50</option>
<option value="51">51</option>
<option value="52">52</option>
<option value="53">53</option>
<option value="54">54</option>
<option value="55">55</option>
<option value="56">56</option>
<option value="57">57</option>
... snipped ....
<option value="58">58</option>
<option value="59">59</option>
</select>
@@ -320,9 +199,9 @@ template code:
</example>
<para>
See also
<link linkend="language.variables.smarty.now">$smarty.now</link>,
<link linkend="language.function.html.select.date">{html_select_date}</link>
and <link linkend="tips.dates">date tips</link>.
<link linkend="language.variables.smarty.now"><parameter>$smarty.now</parameter></link>,
<link linkend="language.function.html.select.date"><varname>{html_select_date}</varname></link>
and the <link linkend="tips.dates">date tips page</link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file

View File

@@ -3,18 +3,11 @@
<sect1 id="language.function.html.table">
<title>{html_table}</title>
<para>
{html_table} is a
<varname>{html_table}</varname> is a
<link linkend="language.custom.functions">custom function</link>
that dumps an array of
data into an HTML table. The <emphasis>cols</emphasis> attribute determines
how many columns will be in the table. The <emphasis>table_attr</emphasis>,
<emphasis>tr_attr</emphasis> and <emphasis>td_attr</emphasis> values
determine the attributes given to the table, tr and td tags. If
<emphasis>tr_attr</emphasis> or <emphasis>td_attr</emphasis> are arrays,
they will be cycled through. <emphasis>trailpad</emphasis> is the value put
into the trailing cells on the last table row if there are any present.
</para>
that dumps an array of data into an HTML table.
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -148,36 +141,48 @@
</tgroup>
</informaltable>
<itemizedlist>
<listitem><para>
The <parameter>cols</parameter> attribute determines how many
columns will be in the table.
</para></listitem>
<listitem><para>
The <parameter>table_attr</parameter>, <parameter>tr_attr</parameter>
and <parameter>td_attr</parameter> values determine the attributes given
to the &lt;table&gt;, &lt;tr&gt; and &lt;td&gt; tags.
</para></listitem>
<listitem><para>
If <parameter>tr_attr</parameter> or <parameter>td_attr</parameter> are
arrays, they will be cycled through.
</para></listitem>
<listitem><para>
<parameter>trailpad</parameter> is the value put into the trailing cells
on the last table row if there are any present.
</para></listitem>
</itemizedlist>
<example>
<title>html_table</title>
<title>{html_table}</title>
<programlisting role="php">
<![CDATA[
php code:
---------
<?php
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->assign('data',array(1,2,3,4,5,6,7,8,9));
$smarty->assign('tr',array('bgcolor="#eeeeee"','bgcolor="#dddddd"'));
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>The variables assigned from php could be displayed as these three
examples demonstrate. Each example shows the template followed by output.
</para>
<programlisting>
<![CDATA[
template code:
--------------
{**** Example One ****}
{html_table loop=$data}
{html_table loop=$data cols=4 table_attr='border="0"'}
{html_table loop=$data cols="first,second,third,fourth" tr_attr=$tr}
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
<table border="1">
<tbody>
<tr><td>1</td><td>2</td><td>3</td></tr>
@@ -185,6 +190,11 @@ template code:
<tr><td>7</td><td>8</td><td>9</td></tr>
</tbody>
</table>
{**** Example Two ****}
{html_table loop=$data cols=4 table_attr='border="0"'}
<table border="0">
<tbody>
<tr><td>1</td><td>2</td><td>3</td><td>4</td></tr>
@@ -192,6 +202,11 @@ template code:
<tr><td>9</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
</tbody>
</table>
{**** Example Three ****}
{html_table loop=$data cols="first,second,third,fourth" tr_attr=$tr}
<table border="1">
<thead>
<tr>
@@ -205,7 +220,8 @@ template code:
</tbody>
</table>
]]>
</screen>
</programlisting>
</example>
</sect1>

View File

@@ -3,11 +3,18 @@
<sect1 id="language.function.mailto">
<title>{mailto}</title>
<para>
{mailto} automates the creation of mailto: links and optionally
encodes them. Encoding e-mails makes it more difficult for
web spiders to lift e-mail addresses off of your site.
<varname>{mailto}</varname> automates the creation of mailto: links
and optionally encodes them. Encoding e-mails makes it more difficult for
web spiders to lift e-mail addresses off of a site.
<note>
<title>Technical Note</title>
<para>
Javascript is probably the most thorough form of
encoding, although you can use hex encoding too.
</para>
</note>
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -30,14 +37,14 @@
<entry>string</entry>
<entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>the e-mail address</entry>
<entry>The e-mail address</entry>
</row>
<row>
<entry>text</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>the text to display, default is the e-mail address</entry>
<entry>The text to display, default is the e-mail address</entry>
</row>
<row>
<entry>encode</entry>
@@ -53,7 +60,7 @@
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>e-mail addresses to carbon copy. Separate entries by a comma.
<entry>Email addresses to carbon copy, separate entries by a comma.
</entry>
</row>
<row>
@@ -61,49 +68,43 @@
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>e-mail addresses to blind carbon copy.
Separate entries by a comma.</entry>
<entry>Email addresses to blind carbon copy,
separate entries by a comma</entry>
</row>
<row>
<entry>subject</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>e-mail subject.</entry>
<entry>Email subject</entry>
</row>
<row>
<entry>newsgroups</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>newsgroups to post to. Separate entries by a comma.</entry>
<entry>Newsgroups to post to, separate entries by a comma.</entry>
</row>
<row>
<entry>followupto</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>addresses to follow up to. Separate entries by a comma.</entry>
<entry>Addresses to follow up to, separate entries by a comma.</entry>
</row>
<row>
<entry>extra</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>any extra information you want passed to the link, such
<entry>Any extra information you want passed to the link, such
as style sheet classes</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<note>
<title>Technical Note</title>
<para>
javascript is probably the most thorough form of
encoding, although you can use hex encoding too.
</para>
</note>
<example>
<title>{mailto} example lines followed by the result</title>
<programlisting>
@@ -142,11 +143,10 @@
</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>
<link linkend="language.modifier.escape"><varname>escape</varname></link>,
<link linkend="language.function.textformat"><varname>{textformat}</varname></link>
and the
<link linkend="tips.obfuscating.email">obfuscating email addresses</link> page.
</para>
</sect1>
<!-- Keep this comment at the end of the file

View File

@@ -3,21 +3,48 @@
<sect1 id="language.function.math">
<title>{math}</title>
<para>
{math} allows the template designer to do math equations in the
template. Any numeric template variables may be used in the
equations, and the result is printed in place of the tag. The
variables used in the equation are passed as parameters, which can
be template variables or static values. +, -, /, *, abs, ceil, cos,
exp, floor, log, log10, max, min, pi, pow, rand, round, sin, sqrt,
srans and tan are all valid operators. Check the PHP documentation
for further information on these math functions.
</para>
<varname>{math}</varname> allows the template designer to do math equations
in the template.
</para>
<itemizedlist>
<listitem><para>
Any numeric template variables may be used in the
equations, and the result is printed in place of the tag.
</para></listitem>
<listitem><para>
The variables used in the equation are passed as parameters,
which can be template variables or static values.
</para></listitem>
<listitem><para>+, -, /, *, abs, ceil, cos, exp, floor, log, log10, max, min,
pi, pow, rand, round, sin, sqrt, srans and tan are all valid operators.
Check the PHP documentation for further information on these
<ulink url="&url.php-manual;eval">math</ulink> functions.
</para></listitem>
<listitem><para>
If you supply the <parameter>assign</parameter> attribute, the output of the
<varname>{math}</varname> function will be assigned to this template
variable instead of being output to the template.
</para></listitem>
</itemizedlist>
<note>
<title>Technical Note</title>
<para>
If you supply the special "assign" attribute, the output of the
math function will be assigned to this template variable instead of
being output to the template.
</para>
<varname>{math}</varname> is an expensive function in performance due to
its use of the php <ulink url="&url.php-manual;eval">
<varname>eval()</varname></ulink> function. Doing the math in PHP is much
more efficient, so whenever possible do the math calculations in the script
and <link linkend="api.assign"><varname>assign()</varname></link>
the results to the template. Definitely avoid repetitive
<varname>{math}</varname> function calls, eg within
<link linkend="language.function.section">
<varname>{section}</varname></link> loops.
</para>
</note>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -40,53 +67,41 @@
<entry>string</entry>
<entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>the equation to execute</entry>
<entry>The equation to execute</entry>
</row>
<row>
<entry>format</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>the format of the result (sprintf)</entry>
<entry>The format of the result (sprintf)</entry>
</row>
<row>
<entry>var</entry>
<entry>numeric</entry>
<entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>equation variable value</entry>
<entry>Equation variable value</entry>
</row>
<row>
<entry>assign</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>template variable the output will be assigned to</entry>
<entry>Template variable the output will be assigned to</entry>
</row>
<row>
<entry>[var ...]</entry>
<entry>numeric</entry>
<entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>equation variable value</entry>
<entry>Equation variable value</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<note>
<title>Technical Note</title>
<para>
{math} is an expensive function in performance due to its use of the php
<ulink url="&url.php-manual;eval">eval()</ulink> function. Doing the math in PHP is much
more
efficient, so whenever possible do the math calculations in PHP
and <link linkend="api.assign">assign()</link>
the results to the template. Definately avoid
repetitive {math} function calls, eg within
<link linkend="language.function.section">{section}</link> loops.
</para>
</note>
<example>
<title>{math}</title>
<para>

View File

@@ -3,20 +3,33 @@
<sect1 id="language.function.popup.init">
<title>{popup_init}</title>
<para>
<link linkend="language.function.popup">{popup}</link>
<link linkend="language.function.popup"><varname>{popup}</varname></link>
is an integration of
<ulink url="&url.overLib;">overLib</ulink>, a library used for popup
windows. These are used for context sensitive information, such as
help windows or tooltips. {popup_init} must be called <emphasis>only once</emphasis>, preferably within the &lt;head&gt; tag
within any page you plan on using the
<link linkend="language.function.popup">{popup}</link> function. The path is relative to the executing script or a fully qualified domain path (ie not the relative to the template).
help windows or tooltips.
</para>
<para>
<ulink url="&url.overLib;">overLib</ulink>
is written and maintained by Erik Bosrup, and the homepage/download is located at
<itemizedlist>
<listitem><para>
<varname>{popup_init}</varname> must be called
<emphasis>only once</emphasis>, preferably within the &lt;head&gt; tag
within any page you plan on using the <link linkend="language.function.popup">
<varname>{popup}</varname></link> function.
</para></listitem>
<listitem><para>
The path is relative to the executing script or a fully qualified domain
path, ie not the relative to the template.
</para></listitem>
<listitem><para>
<ulink url="&url.overLib;">overLib</ulink> is written and maintained by
Erik Bosrup, and the homepage/download is at
<ulink url="&url.overLib;">&url.overLib;</ulink>.
</para>
</para></listitem>
</itemizedlist>
<example>
<title>{popup_init}</title>
<programlisting>

View File

@@ -3,11 +3,11 @@
<sect1 id="language.function.popup">
<title>{popup}</title>
<para>
{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.
<varname>{popup}</varname> is used to create Javascript popup layer/windows.
<link linkend="language.function.popup.init">
<varname>{popup_init}</varname></link> MUST be called first for this to work.
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -37,15 +37,15 @@
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>onMouseOver</emphasis></entry>
<entry>What is used to trigger the popup window. Can be
<entry>what is used to trigger the popup window. Can be
one of onMouseOver or onClick</entry>
</row>
<row>
<entry>sticky</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry><emphasis>false</emphasis></entry>
<entry>Makes the popup stick around until closed</entry>
<entry><emphasis>&false;</emphasis></entry>
<entry>makes the popup stick around until closed</entry>
</row>
<row>
<entry>caption</entry>
@@ -108,7 +108,7 @@
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>sets the font for the "Close" text</entry>
<entry>sets the font for the <quote>Close</quote> text</entry>
</row>
<row>
<entry>textsize</entry>
@@ -129,7 +129,7 @@
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>sets the size of the "Close" text's font</entry>
<entry>sets the size of the <quote>Close</quote> text's font</entry>
</row>
<row>
<entry>width</entry>
@@ -149,28 +149,28 @@
<entry>left</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry><emphasis>false</emphasis></entry>
<entry><emphasis>&false;</emphasis></entry>
<entry>makes the popups go to the left of the mouse</entry>
</row>
<row>
<entry>right</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry><emphasis>false</emphasis></entry>
<entry><emphasis>&false;</emphasis></entry>
<entry>makes the popups go to the right of the mouse</entry>
</row>
<row>
<entry>center</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry><emphasis>false</emphasis></entry>
<entry><emphasis>&false;</emphasis></entry>
<entry>makes the popups go to the center of the mouse</entry>
</row>
<row>
<entry>above</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry><emphasis>false</emphasis></entry>
<entry><emphasis>&false;</emphasis></entry>
<entry>makes the popups go above the mouse. NOTE: only
possible when height has been set</entry>
</row>
@@ -178,7 +178,7 @@
<entry>below</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry><emphasis>false</emphasis></entry>
<entry><emphasis>&false;</emphasis></entry>
<entry>makes the popups go below the mouse</entry>
</row>
<row>
@@ -219,7 +219,7 @@
<entry><emphasis>n/a</emphasis></entry>
<entry>defines a picture to use instead of color for the
border of the popup. NOTE: You will want to set bgcolor
to "" or the color will show as well. NOTE: When having
to <quote></quote> or the color will show as well. NOTE: When having
a Close link, Netscape will re-render the table cells,
making things look incorrect</entry>
</row>
@@ -228,14 +228,14 @@
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>sets the "Close" text to something else</entry>
<entry>sets the <quote>Close</quote> text to something else</entry>
</row>
<row>
<entry>noclose</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>does not display the "Close" text on stickies
<entry>does not display the <quote>Close</quote> text on stickies
with a caption</entry>
</row>
<row>
@@ -349,7 +349,7 @@
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>allows you to control the html over a background
picture completely. The html code is expected in the "text"
picture completely. The html code is expected in the <quote>text</quote>
attribute</entry>
</row>
<row>
@@ -417,13 +417,14 @@ snapx=10 snapy=10 trigger='onClick'}>mypage</a>
]]>
</programlisting>
</example>
<para>There is another good example on the
<link linkend="language.function.capture">{capture}</link> page.</para>
<para>There is another good example on the
<link linkend="language.function.capture"><varname>{capture}</varname>
</link> page.</para>
<para>
See also
<link linkend="language.function.popup.init">{popup_init}</link>
and
<ulink url="&url.overLib;">overLib</ulink>.
<link linkend="language.function.popup.init"><varname>{popup_init}</varname></link>
and the
<ulink url="&url.overLib;">overLib</ulink> homepage.
</para>
</sect1>
<!-- Keep this comment at the end of the file

View File

@@ -3,17 +3,16 @@
<sect1 id="language.function.textformat">
<title>{textformat}</title>
<para>
{textformat} is a
<varname>{textformat}</varname> is a
<link linkend="plugins.block.functions">block function</link>
used to format text. It basically
cleans up spaces and special characters, and formats paragraphs by
wrapping at a boundary and indenting lines.
used to format text. It basically cleans up spaces and special characters,
and formats paragraphs by wrapping at a boundary and indenting lines.
</para>
<para>
You can set the parameters explicitly, or use a preset style.
Currently "email" is the only available style.
Currently <quote>email</quote> is the only available style.
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -43,43 +42,43 @@
<entry>number</entry>
<entry>No</entry>
<entry><emphasis>0</emphasis></entry>
<entry>The number of chars to indent every line</entry>
<entry>the number of chars to indent every line</entry>
</row>
<row>
<entry>indent_first</entry>
<entry>number</entry>
<entry>No</entry>
<entry><emphasis>0</emphasis></entry>
<entry>The number of chars to indent the first line</entry>
<entry>the number of chars to indent the first line</entry>
</row>
<row>
<entry>indent_char</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>(single space)</emphasis></entry>
<entry>The character (or string of chars) to indent with</entry>
<entry>the character (or string of chars) to indent with</entry>
</row>
<row>
<entry>wrap</entry>
<entry>number</entry>
<entry>No</entry>
<entry><emphasis>80</emphasis></entry>
<entry>How many characters to wrap each line to</entry>
<entry>how many characters to wrap each line to</entry>
</row>
<row>
<entry>wrap_char</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>\n</emphasis></entry>
<entry>The character (or string of chars) to break each
<entry>the character (or string of chars) to break each
line with</entry>
</row>
<row>
<entry>wrap_cut</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry><emphasis>false</emphasis></entry>
<entry>If true, wrap will break the line at the exact
<entry><emphasis>&false;</emphasis></entry>
<entry>if &true;, wrap will break the line at the exact
character instead of at a word boundary</entry>
</row>
<row>
@@ -270,9 +269,9 @@
</example>
<para>
See also
<link linkend="language.function.strip">{strip}</link>
<link linkend="language.function.strip"><varname>{strip}</varname></link>
and
<link linkend="language.modifier.wordwrap">{wordwrap}</link>.
<link linkend="language.modifier.wordwrap"><varname>wordwrap</varname></link>.
</para>
</sect1>