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

View File

@@ -3,19 +3,20 @@
<sect1 id="language.function.counter"> <sect1 id="language.function.counter">
<title>{counter}</title> <title>{counter}</title>
<para> <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 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
supplying a unique name for each one. If you do not supply a name, 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>
<para> <para>
If you supply the special "assign" attribute, the output of the If you supply the <parameter>assign</parameter> attribute, the output of the
counter function will be assigned to this template variable instead of <varname>{counter}</varname> function will be assigned to this template
being output to the template. variable instead of being output to the template.
</para> </para>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -59,13 +60,13 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>up</emphasis></entry> <entry><emphasis>up</emphasis></entry>
<entry>the direction to count (up/down)</entry> <entry>The direction to count (up/down)</entry>
</row> </row>
<row> <row>
<entry>print</entry> <entry>print</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>true</emphasis></entry> <entry><emphasis>&true;</emphasis></entry>
<entry>Whether or not to print the value</entry> <entry>Whether or not to print the value</entry>
</row> </row>
<row> <row>
@@ -80,7 +81,7 @@
</informaltable> </informaltable>
<example> <example>
<title>counter</title> <title>{counter}</title>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{* initialize the count *} {* initialize the count *}

View File

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

View File

@@ -2,6 +2,16 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.debug"> <sect1 id="language.function.debug">
<title>{debug}</title> <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"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -29,17 +39,10 @@
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
{debug} dumps the debug console to the page. This works regardless See also the
of the <link linkend="chapter.debugging.console">debug</link> <link linkend="chapter.debugging.console">debugging console page</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>
</para> </para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

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

View File

@@ -3,19 +3,49 @@
<sect1 id="language.function.fetch"> <sect1 id="language.function.fetch">
<title>{fetch}</title> <title>{fetch}</title>
<para> <para>
{fetch} is used to fetch files from the local file system, http, or <varname>{fetch}</varname> is used to retrieve files from the
ftp and display the contents. If the file name begins with local file system, http, or ftp and display the contents.
"http://", the web site page will be fetched and displayed. If the </para>
file name begins with "ftp://", the file will be fetched from the
ftp server and displayed. For local files, the full system file <itemizedlist>
path must be given, or a path relative to the executed php script. <listitem><para>
</para> If the file name begins with
<para> <parameter>http://</parameter>, the web site page will be fetched and displayed.
If you supply the special "assign" attribute, the output of the <note>
{fetch} function will be assigned to this template variable instead of <para>
being output to the template. This will not support http redirects, be sure to
</para> 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"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -38,37 +68,21 @@
<entry>string</entry> <entry>string</entry>
<entry>Yes</entry> <entry>Yes</entry>
<entry><emphasis>n/a</emphasis></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>
<row> <row>
<entry>assign</entry> <entry>assign</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></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> to</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </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> <example>
<title>{fetch} examples</title> <title>{fetch} examples</title>
<programlisting> <programlisting>
@@ -94,11 +108,11 @@
</example> </example>
<para> <para>
See also See also
<link linkend="language.function.capture">{capture}</link>, <link linkend="language.function.capture"><varname>{capture}</varname></link>,
<link linkend="language.function.eval">{eval}</link>, <link linkend="language.function.eval"><varname>{eval}</varname></link>,
<link linkend="language.function.assign">{assign}</link> <link linkend="language.function.assign"><varname>{assign}</varname></link>
and and
<link linkend="api.fetch">fetch()</link>. <link linkend="api.fetch"><varname>fetch()</varname></link>.
</para> </para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

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

View File

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

View File

@@ -3,14 +3,13 @@
<sect1 id="language.function.html.options"> <sect1 id="language.function.html.options">
<title>{html_options}</title> <title>{html_options}</title>
<para> <para>
{html_options} is a <varname>{html_options}</varname> is a
<link linkend="language.custom.functions">custom function</link> <link linkend="language.custom.functions">custom function</link>
that creates html &lt;select&gt;&lt;option&gt; group that creates a html &lt;select&gt;&lt;option&gt; group
with provided data. It takes care of which item(s) are selected by with the assigned data. It takes care of which item(s) are selected by
default as well. Required attributes are values and output, unless default as well.
you use options instead. </para>
</para>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -67,94 +66,119 @@
</tgroup> </tgroup>
</informaltable> </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;, 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 and display the groups. Recursion is supported with &lt;optgroup&gt;.
output is XHTML compatible. </para></listitem>
</para>
<para> <listitem><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>
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 &lt;select&gt; tag. They are ignored if name/value-pairs inside the &lt;select&gt; tag. They are ignored if
the optional <emphasis>name</emphasis> is not given. the optional <parameter>name</parameter> is not given.
</para> </para></listitem>
<listitem><para>
All output is XHTML compliant.
</para></listitem>
</itemizedlist>
<example> <example>
<title>{html_options}</title> <title>Associative array with the <varname>options</varname> attribute</title>
<para>
<emphasis role="bold">Example 1:</emphasis>
</para>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?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( $smarty->assign('cust_names', array(
'Joe Schmoe', 'Joe Schmoe',
'Jack Smith',
'Jane Johnson', 'Jane Johnson',
'Charlie Brown')); 'Charlie Brown'));
$smarty->assign('customer_id', 1001); $smarty->assign('customer_id', 92);
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <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> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
<select name="customer_id"> <select name="customer_id" size="{$cust_names|@count}">
{html_options values=$cust_ids output=$cust_names selected=$customer_id} {html_options values=$cust_ids output=$cust_names selected=$customer_id}
</select> </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> </programlisting>
<para> <para>
where template is: The above example would output:
</para>
<programlisting>
<![CDATA[
{html_options name=customer_id options=$cust_options selected=$customer_id}
]]>
</programlisting>
<para>
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="56">Joe Schmoe</option>
<option label="Jack Smith" value="1001" selected="selected">Jack Smith</option> <option label="Jack Smith" value="92" selected="selected">Jane Johnson</option>
<option label="Jane Johnson" value="1002">Jane Johnson</option> <option label="Charlie Brown" value="13">Charlie Brown</option>
<option label="Charlie Brown" value="1003">Charlie Brown</option>
</select> </select>
]]> ]]>
</screen> </screen>
</example> </example>
<example> <example>
<title>{html_options} - Database example (eg PEAR or ADODB):</title> <title>Database example (eg ADODB or PEAR)</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -170,7 +194,7 @@ $smarty->assign('contact',$db->getRow($sql));
]]> ]]>
</programlisting> </programlisting>
<para> <para>
where the template is: where an example template would be
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -181,11 +205,53 @@ where the template is:
]]> ]]>
</programlisting> </programlisting>
</example> </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> <para>
See also See also
<link linkend="language.function.html.checkboxes">{html_checkboxes}</link> <link linkend="language.function.html.checkboxes"><varname>{html_checkboxes}</varname></link>
and and
<link linkend="language.function.html.radios">{html_radios}</link> <link linkend="language.function.html.radios"><varname>{html_radios}</varname></link>
</para> </para>
</sect1> </sect1>

View File

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

View File

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

View File

@@ -3,12 +3,18 @@
<sect1 id="language.function.html.select.time"> <sect1 id="language.function.html.select.time">
<title>{html_select_time}</title> <title>{html_select_time}</title>
<para> <para>
{html_select_time} is a <varname>{html_select_time}</varname> is a
<link linkend="language.custom.functions">custom function</link> <link linkend="language.custom.functions">custom function</link>
that creates time dropdowns for you. It can display that creates time dropdowns for you.
any or all of hour, minute, second and meridian. It can display any or all of hour, minute, second and meridian.
</para> </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"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -31,85 +37,84 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>Time_</entry> <entry>Time_</entry>
<entry>what to prefix the var name with</entry> <entry>What to prefix the var name with</entry>
</row> </row>
<row> <row>
<entry>time</entry> <entry>time</entry>
<entry>timestamp</entry> <entry>timestamp</entry>
<entry>No</entry> <entry>No</entry>
<entry>current time</entry> <entry>current time</entry>
<entry>what date/time to use</entry> <entry>What date/time to use</entry>
</row> </row>
<row> <row>
<entry>display_hours</entry> <entry>display_hours</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry>true</entry> <entry>&true;</entry>
<entry>whether or not to display hours</entry> <entry>Whether or not to display hours</entry>
</row> </row>
<row> <row>
<entry>display_minutes</entry> <entry>display_minutes</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry>true</entry> <entry>&true;</entry>
<entry>whether or not to display minutes</entry> <entry>Whether or not to display minutes</entry>
</row> </row>
<row> <row>
<entry>display_seconds</entry> <entry>display_seconds</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry>true</entry> <entry>&true;</entry>
<entry>whether or not to display seconds</entry> <entry>Whether or not to display seconds</entry>
</row> </row>
<row> <row>
<entry>display_meridian</entry> <entry>display_meridian</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry>true</entry> <entry>&true;</entry>
<entry>whether or not to display meridian (am/pm)</entry> <entry>Whether or not to display meridian (am/pm)</entry>
</row> </row>
<row> <row>
<entry>use_24_hours</entry> <entry>use_24_hours</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry>true</entry> <entry>&true;</entry>
<entry>whether or not to use 24 hour clock</entry> <entry>Whether or not to use 24 hour clock</entry>
</row> </row>
<row> <row>
<entry>minute_interval</entry> <entry>minute_interval</entry>
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry>1</entry> <entry>1</entry>
<entry>number interval in minute dropdown</entry> <entry>Number interval in minute dropdown</entry>
</row> </row>
<row> <row>
<entry>second_interval</entry> <entry>second_interval</entry>
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry>1</entry> <entry>1</entry>
<entry>number interval in second dropdown</entry> <entry>Number interval in second dropdown</entry>
</row> </row>
<row> <row>
<entry>field_array</entry> <entry>field_array</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>n/a</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>
<row> <row>
<entry>all_extra</entry> <entry>all_extra</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>null</entry> <entry>null</entry>
<entry>adds extra attributes to select/input tags if <entry>Adds extra attributes to select/input tags if given</entry>
given</entry>
</row> </row>
<row> <row>
<entry>hour_extra</entry> <entry>hour_extra</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>null</entry> <entry>null</entry>
<entry>adds extra attributes to select/input tags if <entry>Adds extra attributes to select/input tags if
given</entry> given</entry>
</row> </row>
<row> <row>
@@ -117,7 +122,7 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>null</entry> <entry>null</entry>
<entry>adds extra attributes to select/input tags if <entry>Adds extra attributes to select/input tags if
given</entry> given</entry>
</row> </row>
<row> <row>
@@ -125,7 +130,7 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>null</entry> <entry>null</entry>
<entry>adds extra attributes to select/input tags if <entry>Adds extra attributes to select/input tags if
given</entry> given</entry>
</row> </row>
<row> <row>
@@ -133,181 +138,55 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>null</entry> <entry>null</entry>
<entry>adds extra attributes to select/input tags if <entry>Adds extra attributes to select/input tags if
given</entry> given</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </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> <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>
<para> <para>
This will output: At 9:20 and 23 seconds in the morning the template above would output:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
<select name="Time_Hour"> <select name="Time_Hour">
<option value="00">00</option> <option value="00">00</option>
<option value="01">01</option> <option value="01">01</option>
<option value="02">02</option> ... snipped ....
<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="08">08</option>
<option value="09" selected>09</option> <option value="09" selected>09</option>
<option value="10">10</option> <option value="10">10</option>
<option value="11">11</option> ... snipped ....
<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>
<option value="22">22</option> <option value="22">22</option>
<option value="23">23</option> <option value="23">23</option>
</select> </select>
<select name="Time_Minute"> <select name="Time_Minute">
<option value="00">00</option> <option value="00">00</option>
<option value="01">01</option> <option value="01">01</option>
<option value="02">02</option> ... snipped ....
<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="19">19</option>
<option value="20" selected>20</option> <option value="20" selected>20</option>
<option value="21">21</option> <option value="21">21</option>
<option value="22">22</option> ... snipped ....
<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>
<option value="58">58</option> <option value="58">58</option>
<option value="59">59</option> <option value="59">59</option>
</select> </select>
<select name="Time_Second"> <select name="Time_Second">
<option value="00">00</option> <option value="00">00</option>
<option value="01">01</option> <option value="01">01</option>
<option value="02">02</option> ... snipped ....
<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>
<option value="22">22</option> <option value="22">22</option>
<option value="23" selected>23</option> <option value="23" selected>23</option>
<option value="24">24</option> <option value="24">24</option>
<option value="25">25</option> ... snipped ....
<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>
<option value="58">58</option> <option value="58">58</option>
<option value="59">59</option> <option value="59">59</option>
</select> </select>
@@ -320,9 +199,9 @@ template code:
</example> </example>
<para> <para>
See also See also
<link linkend="language.variables.smarty.now">$smarty.now</link>, <link linkend="language.variables.smarty.now"><parameter>$smarty.now</parameter></link>,
<link linkend="language.function.html.select.date">{html_select_date}</link> <link linkend="language.function.html.select.date"><varname>{html_select_date}</varname></link>
and <link linkend="tips.dates">date tips</link>. and the <link linkend="tips.dates">date tips page</link>.
</para> </para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -3,18 +3,11 @@
<sect1 id="language.function.html.table"> <sect1 id="language.function.html.table">
<title>{html_table}</title> <title>{html_table}</title>
<para> <para>
{html_table} is a <varname>{html_table}</varname> is a
<link linkend="language.custom.functions">custom function</link> <link linkend="language.custom.functions">custom function</link>
that dumps an array of that dumps an array of data into an HTML table.
data into an HTML table. The <emphasis>cols</emphasis> attribute determines </para>
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>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -148,36 +141,48 @@
</tgroup> </tgroup>
</informaltable> </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> <example>
<title>html_table</title> <title>{html_table}</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
php code:
---------
<?php <?php
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->assign('data',array(1,2,3,4,5,6,7,8,9)); $smarty->assign('data',array(1,2,3,4,5,6,7,8,9));
$smarty->assign('tr',array('bgcolor="#eeeeee"','bgcolor="#dddddd"')); $smarty->assign('tr',array('bgcolor="#eeeeee"','bgcolor="#dddddd"'));
$smarty->display('index.tpl'); $smarty->display('index.tpl');
?> ?>
]]> ]]>
</programlisting> </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> <programlisting>
<![CDATA[ <![CDATA[
template code: {**** Example One ****}
--------------
{html_table loop=$data} {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"> <table border="1">
<tbody> <tbody>
<tr><td>1</td><td>2</td><td>3</td></tr> <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> <tr><td>7</td><td>8</td><td>9</td></tr>
</tbody> </tbody>
</table> </table>
{**** Example Two ****}
{html_table loop=$data cols=4 table_attr='border="0"'}
<table border="0"> <table border="0">
<tbody> <tbody>
<tr><td>1</td><td>2</td><td>3</td><td>4</td></tr> <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> <tr><td>9</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
</tbody> </tbody>
</table> </table>
{**** Example Three ****}
{html_table loop=$data cols="first,second,third,fourth" tr_attr=$tr}
<table border="1"> <table border="1">
<thead> <thead>
<tr> <tr>
@@ -205,7 +220,8 @@ template code:
</tbody> </tbody>
</table> </table>
]]> ]]>
</screen> </programlisting>
</example> </example>
</sect1> </sect1>

View File

@@ -3,11 +3,18 @@
<sect1 id="language.function.mailto"> <sect1 id="language.function.mailto">
<title>{mailto}</title> <title>{mailto}</title>
<para> <para>
{mailto} automates the creation of mailto: links and optionally <varname>{mailto}</varname> automates the creation of mailto: links
encodes them. Encoding e-mails makes it more difficult for and optionally encodes them. Encoding e-mails makes it more difficult for
web spiders to lift e-mail addresses off of your site. 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> </para>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -30,14 +37,14 @@
<entry>string</entry> <entry>string</entry>
<entry>Yes</entry> <entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>the e-mail address</entry> <entry>The e-mail address</entry>
</row> </row>
<row> <row>
<entry>text</entry> <entry>text</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></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>
<row> <row>
<entry>encode</entry> <entry>encode</entry>
@@ -53,7 +60,7 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></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> </entry>
</row> </row>
<row> <row>
@@ -61,49 +68,43 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>e-mail addresses to blind carbon copy. <entry>Email addresses to blind carbon copy,
Separate entries by a comma.</entry> separate entries by a comma</entry>
</row> </row>
<row> <row>
<entry>subject</entry> <entry>subject</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>e-mail subject.</entry> <entry>Email subject</entry>
</row> </row>
<row> <row>
<entry>newsgroups</entry> <entry>newsgroups</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></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>
<row> <row>
<entry>followupto</entry> <entry>followupto</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></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>
<row> <row>
<entry>extra</entry> <entry>extra</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></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> as style sheet classes</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </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> <example>
<title>{mailto} example lines followed by the result</title> <title>{mailto} example lines followed by the result</title>
<programlisting> <programlisting>
@@ -142,11 +143,10 @@
</example> </example>
<para> <para>
See also See also
<link linkend="language.modifier.escape">escape</link>, <link linkend="language.modifier.escape"><varname>escape</varname></link>,
<link linkend="tips.obfuscating.email">Obfuscating E-mail Addresses</link> <link linkend="language.function.textformat"><varname>{textformat}</varname></link>
and and the
<link linkend="language.function.textformat">{textformat}</link> <link linkend="tips.obfuscating.email">obfuscating email addresses</link> page.
</para> </para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

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

View File

@@ -3,20 +3,33 @@
<sect1 id="language.function.popup.init"> <sect1 id="language.function.popup.init">
<title>{popup_init}</title> <title>{popup_init}</title>
<para> <para>
<link linkend="language.function.popup">{popup}</link> <link linkend="language.function.popup"><varname>{popup}</varname></link>
is an integration of is an integration of
<ulink url="&url.overLib;">overLib</ulink>, a library used for popup <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 <emphasis>only once</emphasis>, preferably within the &lt;head&gt; tag help windows or tooltips.
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).
</para> </para>
<para>
<ulink url="&url.overLib;">overLib</ulink> <itemizedlist>
is written and maintained by Erik Bosrup, and the homepage/download is located at <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>. <ulink url="&url.overLib;">&url.overLib;</ulink>.
</para> </para></listitem>
</itemizedlist>
<example> <example>
<title>{popup_init}</title> <title>{popup_init}</title>
<programlisting> <programlisting>

View File

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

View File

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