mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-02 21:31:48 +01:00
2683 lines
104 KiB
XML
2683 lines
104 KiB
XML
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||
|
|
<!-- $Revision$ -->
|
||
|
|
<chapter id="language.custom.functions">
|
||
|
|
<title>Custom Functions</title>
|
||
|
|
<para>
|
||
|
|
Smarty comes with several custom functions that you can
|
||
|
|
use in the templates.
|
||
|
|
</para>
|
||
|
|
<sect1 id="language.function.assign">
|
||
|
|
<title>assign</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>var</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>Yes</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>The name of the variable being assigned</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>value</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>Yes</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>The value being assigned</entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
assign is used for assigning template variables during the execution
|
||
|
|
of the template.
|
||
|
|
</para>
|
||
|
|
<example>
|
||
|
|
<title>assign</title>
|
||
|
|
<programlisting>
|
||
|
|
{assign var="name" value="Bob"}
|
||
|
|
|
||
|
|
The value of $name is {$name}.
|
||
|
|
|
||
|
|
OUTPUT:
|
||
|
|
|
||
|
|
The value of $name is Bob.</programlisting>
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.counter">
|
||
|
|
<title>counter</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>name</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>default</emphasis></entry>
|
||
|
|
<entry>The name of the counter</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>start</entry>
|
||
|
|
<entry>number</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>1</emphasis></entry>
|
||
|
|
<entry>The initial number to start counting from</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>skip</entry>
|
||
|
|
<entry>number</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>1</emphasis></entry>
|
||
|
|
<entry>The interval to count by</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>direction</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>up</emphasis></entry>
|
||
|
|
<entry>the direction to count (up/down)</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>print</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>true</emphasis></entry>
|
||
|
|
<entry>Whether or not to print the value</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>assign</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>the template variable the output will be assigned
|
||
|
|
to</entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
counter is used to print out a count. counter will remember the
|
||
|
|
count on each iteration. You can adjust the number, the interval
|
||
|
|
and the direction of the count, as well as determine whether or not
|
||
|
|
to print the value. You can run multiple counters concurrently by
|
||
|
|
supplying a unique name for each one. If you do not supply a name,
|
||
|
|
the name 'default' will be used.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
If you supply the special "assign" attribute, the output of the
|
||
|
|
counter function will be assigned to this template variable instead of
|
||
|
|
being output to the template.
|
||
|
|
</para>
|
||
|
|
<example>
|
||
|
|
<title>counter</title>
|
||
|
|
<programlisting>
|
||
|
|
{* initialize the count *}
|
||
|
|
{counter start=0 skip=2}<br>
|
||
|
|
{counter}<br>
|
||
|
|
{counter}<br>
|
||
|
|
{counter}<br>
|
||
|
|
|
||
|
|
OUTPUT:
|
||
|
|
|
||
|
|
0<br>
|
||
|
|
2<br>
|
||
|
|
4<br>
|
||
|
|
6<br></programlisting>
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.cycle">
|
||
|
|
<title>cycle</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>name</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>default</emphasis></entry>
|
||
|
|
<entry>The name of the cycle</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>values</entry>
|
||
|
|
<entry>mixed</entry>
|
||
|
|
<entry>Yes</entry>
|
||
|
|
<entry><emphasis>N/A</emphasis></entry>
|
||
|
|
<entry>The values to cycle through, either a comma
|
||
|
|
delimited list (see delimiter attribute), or an array
|
||
|
|
of values.</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>print</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>true</emphasis></entry>
|
||
|
|
<entry>Whether to print the value or not</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>advance</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>true</emphasis></entry>
|
||
|
|
<entry>Whether or not to advance to the next value</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>delimiter</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>,</emphasis></entry>
|
||
|
|
<entry>The delimiter to use in the values attribute.</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>assign</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>the template variable the output will be assigned
|
||
|
|
to</entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
Cycle is used to cycle though a set of values. This makes it easy
|
||
|
|
to alternate between two or more colors in a table, or cycle
|
||
|
|
through an array of values.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
You can cycle through more than one set of values in your template
|
||
|
|
by supplying a name attribute. Give each set of values a unique
|
||
|
|
name.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
You can force the current value not to print with the print
|
||
|
|
attribute set to false. This would be useful for silently skipping
|
||
|
|
a value.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
The advance attribute is used to repeat a value. When set to false,
|
||
|
|
the next call to cycle will print the same value.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
If you supply the special "assign" attribute, the output of the
|
||
|
|
cycle function will be assigned to this template variable instead of
|
||
|
|
being output to the template.
|
||
|
|
</para>
|
||
|
|
<example>
|
||
|
|
<title>cycle</title>
|
||
|
|
<programlisting>
|
||
|
|
{section name=rows loop=$data}
|
||
|
|
<tr bgcolor="{cycle values="#eeeeee,#d0d0d0"}">
|
||
|
|
<td>{$data[rows]}</td>
|
||
|
|
</tr>
|
||
|
|
{/section}
|
||
|
|
|
||
|
|
OUTPUT:
|
||
|
|
|
||
|
|
<tr bgcolor="#eeeeee">
|
||
|
|
<td>1</td>
|
||
|
|
</tr>
|
||
|
|
<tr bgcolor="#d0d0d0">
|
||
|
|
<td>2</td>
|
||
|
|
</tr>
|
||
|
|
<tr bgcolor="#eeeeee">
|
||
|
|
<td>3</td>
|
||
|
|
</tr>
|
||
|
|
</programlisting>
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.debug">
|
||
|
|
<title>debug</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>output</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>html</emphasis></entry>
|
||
|
|
<entry>output type, html or javascript</entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
{debug} dumps the debug console to the page. This works regardless
|
||
|
|
of the <link linkend="chapter.debugging.console">debug</link>
|
||
|
|
settings in Smarty. Since this gets executed at runtime, this is
|
||
|
|
only able to show the assigned variables, not the templates that
|
||
|
|
are in use. But, you see all the currently available variables
|
||
|
|
within the scope of this template.
|
||
|
|
</para>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.eval">
|
||
|
|
<title>eval</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>var</entry>
|
||
|
|
<entry>mixed</entry>
|
||
|
|
<entry>Yes</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>variable (or string) to evaluate</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>assign</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>the template variable the output will be assigned
|
||
|
|
to</entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
eval is used to evaluate a variable as a template. This can be used
|
||
|
|
for things like embedding template tags/variables into variables or
|
||
|
|
tags/variables into config file variables.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
If you supply the special "assign" attribute, the output of the
|
||
|
|
eval function will be assigned to this template variable instead of
|
||
|
|
being output to the template.
|
||
|
|
</para>
|
||
|
|
<note>
|
||
|
|
<title>Technical Note</title>
|
||
|
|
<para>
|
||
|
|
Evaluated variables are treated the same as templates. They follow
|
||
|
|
the same escapement and security features just as if they were
|
||
|
|
templates.
|
||
|
|
</para>
|
||
|
|
</note>
|
||
|
|
<note>
|
||
|
|
<title>Technical Note</title>
|
||
|
|
<para>
|
||
|
|
Evaluated variables are compiled on every invocation, the compiled
|
||
|
|
versions are not saved! However if you have caching enabled, the
|
||
|
|
output will be cached with the rest of the template.
|
||
|
|
</para>
|
||
|
|
</note>
|
||
|
|
<example>
|
||
|
|
<title>eval</title>
|
||
|
|
<programlisting>
|
||
|
|
setup.conf
|
||
|
|
----------
|
||
|
|
|
||
|
|
emphstart = <b>
|
||
|
|
emphend = </b>
|
||
|
|
title = Welcome to {$company}'s home page!
|
||
|
|
ErrorCity = You must supply a {#emphstart#}city{#emphend#}.
|
||
|
|
ErrorState = You must supply a {#emphstart#}state{#emphend#}.
|
||
|
|
|
||
|
|
|
||
|
|
index.tpl
|
||
|
|
---------
|
||
|
|
|
||
|
|
{config_load file="setup.conf"}
|
||
|
|
|
||
|
|
{eval var=$foo}
|
||
|
|
{eval var=#title#}
|
||
|
|
{eval var=#ErrorCity#}
|
||
|
|
{eval var=#ErrorState# assign="state_error"}
|
||
|
|
{$state_error}
|
||
|
|
|
||
|
|
OUTPUT:
|
||
|
|
|
||
|
|
This is the contents of foo.
|
||
|
|
Welcome to Foobar Pub & Grill's home page!
|
||
|
|
You must supply a <b>city</b>.
|
||
|
|
You must supply a <b>state</b>.
|
||
|
|
|
||
|
|
</programlisting>
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.fetch">
|
||
|
|
<title>fetch</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>file</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>Yes</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>the file, http or ftp site to fetch</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>assign</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>the template variable the output will be assigned
|
||
|
|
to</entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
fetch is used to fetch files from the local file system, http, or
|
||
|
|
ftp and display the contents. If the file name begins with
|
||
|
|
"http://", the web site page will be fetched and displayed. If the
|
||
|
|
file name begins with "ftp://", the file will be fetched from the
|
||
|
|
ftp server and displayed. For local files, the full system file
|
||
|
|
path must be given, or a path relative to the executed php script.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
If you supply the special "assign" attribute, the output of the
|
||
|
|
fetch function will be assigned to this template variable instead of
|
||
|
|
being output to the template. (new in Smarty 1.5.0)
|
||
|
|
</para>
|
||
|
|
<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 security is turned on and you are
|
||
|
|
fetching a file from the local file system, this will only allow
|
||
|
|
files from within one of the defined secure directories.
|
||
|
|
($secure_dir)
|
||
|
|
</para>
|
||
|
|
</note>
|
||
|
|
<example>
|
||
|
|
<title>fetch</title>
|
||
|
|
<programlisting>
|
||
|
|
{* include some javascript in your template *}
|
||
|
|
{fetch file="/export/httpd/www.domain.com/docs/navbar.js"}
|
||
|
|
|
||
|
|
{* embed some weather text in your template from another web site *}
|
||
|
|
{fetch file="http://www.myweather.com/68502/"}
|
||
|
|
|
||
|
|
{* fetch a news headline file via ftp *}
|
||
|
|
{fetch file="ftp://user:password@ftp.domain.com/path/to/currentheadlines.txt"}
|
||
|
|
|
||
|
|
{* assign the fetched contents to a template variable *}
|
||
|
|
{fetch file="http://www.myweather.com/68502/" assign="weather"}
|
||
|
|
{if $weather ne ""}
|
||
|
|
<b>{$weather}</b>
|
||
|
|
{/if}</programlisting>
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.html.checkboxes">
|
||
|
|
<title>html_checkboxes</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>name</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>checkbox</emphasis></entry>
|
||
|
|
<entry>name of checkbox list</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>values</entry>
|
||
|
|
<entry>array</entry>
|
||
|
|
<entry>Yes, unless using options attribute</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>an array of values for checkbox buttons</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>output</entry>
|
||
|
|
<entry>array</entry>
|
||
|
|
<entry>Yes, unless using options attribute</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>an array of output for checkbox buttons</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>selected</entry>
|
||
|
|
<entry>string/array</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>empty</emphasis></entry>
|
||
|
|
<entry>the selected checkbox element(s)</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>options</entry>
|
||
|
|
<entry>associative array</entry>
|
||
|
|
<entry>Yes, unless using values and output</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>an associative array of values and output</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>separator</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>empty</emphasis></entry>
|
||
|
|
<entry>string of text to separate each checkbox item</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>labels</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>true</emphasis></entry>
|
||
|
|
<entry>add <label>-tags to the output</entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
html_checkboxes is a custom function that creates an html checkbox
|
||
|
|
group with provided data. It takes care of which item(s) are
|
||
|
|
selected by default as well. Required attributes are values and
|
||
|
|
output, unless you use options instead. All output is XHTML
|
||
|
|
compatible.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
All parameters that are not in the list above are printed as
|
||
|
|
name/value-pairs inside each of the created <input>-tags.
|
||
|
|
</para>
|
||
|
|
<example>
|
||
|
|
<title>html_checkboxes</title>
|
||
|
|
<programlisting>
|
||
|
|
index.php:
|
||
|
|
|
||
|
|
require('Smarty.class.php');
|
||
|
|
$smarty = new Smarty;
|
||
|
|
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
|
||
|
|
$smarty->assign('cust_names', array('Joe Schmoe','Jack Smith','Jane Johnson','Charlie Brown'));
|
||
|
|
$smarty->assign('customer_id', 1001);
|
||
|
|
$smarty->display('index.tpl');
|
||
|
|
|
||
|
|
|
||
|
|
index.tpl:
|
||
|
|
|
||
|
|
{html_checkboxes name="id" values=$cust_ids selected=$customer_id output=$cust_names separator="<br />"}
|
||
|
|
|
||
|
|
|
||
|
|
index.php:
|
||
|
|
|
||
|
|
require('Smarty.class.php');
|
||
|
|
$smarty = new Smarty;
|
||
|
|
$smarty->assign('cust_checkboxes', array(
|
||
|
|
1000 => 'Joe Schmoe',
|
||
|
|
1001 => 'Jack Smith',
|
||
|
|
1002 => 'Jane Johnson',
|
||
|
|
1003 => 'Charlie Brown'));
|
||
|
|
$smarty->assign('customer_id', 1001);
|
||
|
|
$smarty->display('index.tpl');
|
||
|
|
|
||
|
|
index.tpl:
|
||
|
|
|
||
|
|
{html_checkboxes name="id" options=$cust_checkboxes selected=$customer_id separator="<br />"}
|
||
|
|
|
||
|
|
|
||
|
|
OUTPUT: (both examples)
|
||
|
|
|
||
|
|
<label><input type="checkbox" name="id[]" value="1000" />Joe Schmoe</label><br />
|
||
|
|
<label><input type="checkbox" name="id[]" value="1001" checked="checked" />Jack Smith</label><br />
|
||
|
|
<label><input type="checkbox" name="id[]" value="1002" />Jane Johnson</label><br />
|
||
|
|
<label><input type="checkbox" name="id[]" value="1003" />Charlie Brown</label><br /></programlisting>
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.html.image">
|
||
|
|
<title>html_image</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>file</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>Yes</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>name/path to image</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>border</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>0</emphasis></entry>
|
||
|
|
<entry>size of border around image</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>height</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>actual image height</emphasis></entry>
|
||
|
|
<entry>height to display image</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>width</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>actual image width</emphasis></entry>
|
||
|
|
<entry>width to display image</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>basedir</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>no</entry>
|
||
|
|
<entry><emphasis>web server doc root</emphasis></entry>
|
||
|
|
<entry>directory to base relative paths from</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>alt</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>no</entry>
|
||
|
|
<entry><emphasis>""</emphasis></entry>
|
||
|
|
<entry>alternative description of the image</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>href</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>no</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>href value to link the image to</entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
html_image is a custom function that generates an HTML tag for an
|
||
|
|
image. The height and width are automatically calculated from the
|
||
|
|
image file if none are supplied.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
basedir is the base directory that relative image paths are based
|
||
|
|
from. If not given, the web server document root (env variable
|
||
|
|
DOCUMENT_ROOT) is used as the base. If security is enabled, the
|
||
|
|
path to the image must be within a secure directory.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
<parameter>href</parameter> is the href value to link the image to. If link is supplied, an
|
||
|
|
<a href="LINKVALUE"><a> tag is put around the image tag.
|
||
|
|
</para>
|
||
|
|
<note>
|
||
|
|
<title>Technical Note</title>
|
||
|
|
<para>
|
||
|
|
html_image requires a hit to the disk to read the image and
|
||
|
|
calculate the height and width. If you don't use template
|
||
|
|
caching, it is generally better to avoid html_image and leave
|
||
|
|
image tags static for optimal performance.
|
||
|
|
</para>
|
||
|
|
</note>
|
||
|
|
<example>
|
||
|
|
<title>html_image</title>
|
||
|
|
<programlisting>
|
||
|
|
index.php:
|
||
|
|
|
||
|
|
require('Smarty.class.php');
|
||
|
|
$smarty = new Smarty;
|
||
|
|
$smarty->display('index.tpl');
|
||
|
|
|
||
|
|
index.tpl:
|
||
|
|
|
||
|
|
{html_image file="pumpkin.jpg"}
|
||
|
|
{html_image file="/path/from/docroot/pumpkin.jpg"}
|
||
|
|
{html_image file="../path/relative/to/currdir/pumpkin.jpg"}
|
||
|
|
|
||
|
|
OUTPUT: (possible)
|
||
|
|
|
||
|
|
<img src="pumpkin.jpg" alt="" border="0" width="44" height="68" />
|
||
|
|
<img src="/path/from/docroot/pumpkin.jpg" alt="" border="0" width="44" height="68" />
|
||
|
|
<img src="../path/relative/to/currdir/pumpkin.jpg" alt="" border="0" width="44" height="68" /></programlisting>
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.html.options">
|
||
|
|
<title>html_options</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>values</entry>
|
||
|
|
<entry>array</entry>
|
||
|
|
<entry>Yes, unless using options attribute</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>an array of values for dropdown</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>output</entry>
|
||
|
|
<entry>array</entry>
|
||
|
|
<entry>Yes, unless using options attribute</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>an array of output for dropdown</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>selected</entry>
|
||
|
|
<entry>string/array</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>empty</emphasis></entry>
|
||
|
|
<entry>the selected option element(s)</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>options</entry>
|
||
|
|
<entry>associative array</entry>
|
||
|
|
<entry>Yes, unless using values and output</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>an associative array of values and output</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>name</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>empty</emphasis></entry>
|
||
|
|
<entry>name of select group</entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
html_options is a custom function that creates html option group
|
||
|
|
with provided data. It takes care of which item(s) are selected by
|
||
|
|
default as well. Required attributes are values and output, unless
|
||
|
|
you use options instead.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
If a given value is an array, it will treat it as an html OPTGROUP,
|
||
|
|
and display the groups. Recursion is supported with OPTGROUP. All
|
||
|
|
output is XHTML compatible.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
If the optional <emphasis>name</emphasis> attribute is given, the
|
||
|
|
<select name="groupname"></select> tags will enclose
|
||
|
|
the option list. Otherwise only the option list is generated.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
All parameters that are not in the list above are printed as
|
||
|
|
name/value-pairs inside the <select>-tag. They are ignored if
|
||
|
|
the optional <emphasis>name</emphasis> is not given.
|
||
|
|
</para>
|
||
|
|
<example>
|
||
|
|
<title>html_options</title>
|
||
|
|
<programlisting>
|
||
|
|
index.php:
|
||
|
|
|
||
|
|
require('Smarty.class.php');
|
||
|
|
$smarty = new Smarty;
|
||
|
|
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
|
||
|
|
$smarty->assign('cust_names', array('Joe Schmoe','Jack Smith','Jane
|
||
|
|
Johnson','Carlie Brown'));
|
||
|
|
$smarty->assign('customer_id', 1001);
|
||
|
|
$smarty->display('index.tpl');
|
||
|
|
|
||
|
|
index.tpl:
|
||
|
|
|
||
|
|
<select name=customer_id>
|
||
|
|
{html_options values=$cust_ids selected=$customer_id output=$cust_names}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
index.php:
|
||
|
|
|
||
|
|
require('Smarty.class.php');
|
||
|
|
$smarty = new Smarty;
|
||
|
|
$smarty->assign('cust_options', array(
|
||
|
|
1001 => 'Joe Schmoe',
|
||
|
|
1002 => 'Jack Smith',
|
||
|
|
1003 => 'Jane Johnson',
|
||
|
|
1004 => 'Charlie Brown'));
|
||
|
|
$smarty->assign('customer_id', 1001);
|
||
|
|
$smarty->display('index.tpl');
|
||
|
|
|
||
|
|
index.tpl:
|
||
|
|
|
||
|
|
<select name=customer_id>
|
||
|
|
{html_options options=$cust_options selected=$customer_id}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
|
||
|
|
OUTPUT: (both examples)
|
||
|
|
|
||
|
|
<select name=customer_id>
|
||
|
|
<option value="1000">Joe Schmoe</option>
|
||
|
|
<option value="1001" selected="selected">Jack Smith</option>
|
||
|
|
<option value="1002">Jane Johnson</option>
|
||
|
|
<option value="1003">Charlie Brown</option>
|
||
|
|
</select></programlisting>
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.html.radios">
|
||
|
|
<title>html_radios</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>name</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>radio</emphasis></entry>
|
||
|
|
<entry>name of radio list</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>values</entry>
|
||
|
|
<entry>array</entry>
|
||
|
|
<entry>Yes, unless using options attribute</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>an array of values for radio buttons</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>output</entry>
|
||
|
|
<entry>array</entry>
|
||
|
|
<entry>Yes, unless using options attribute</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>an array of output for radio buttons</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>selected</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>empty</emphasis></entry>
|
||
|
|
<entry>the selected radio element</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>options</entry>
|
||
|
|
<entry>associative array</entry>
|
||
|
|
<entry>Yes, unless using values and output</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>an associative array of values and output</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>separator</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>empty</emphasis></entry>
|
||
|
|
<entry>string of text to separate each radio item</entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
html_radios is a custom function that creates html radio button
|
||
|
|
group with provided data. It takes care of which item is selected
|
||
|
|
by default as well. Required attributes are values and output,
|
||
|
|
unless you use options instead. All output is XHTML compatible.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
All parameters that are not in the list above are printed as
|
||
|
|
name/value-pairs inside each of the created <input>-tags.
|
||
|
|
</para>
|
||
|
|
|
||
|
|
<example>
|
||
|
|
<title>html_radios</title>
|
||
|
|
<programlisting>
|
||
|
|
index.php:
|
||
|
|
|
||
|
|
require('Smarty.class.php');
|
||
|
|
$smarty = new Smarty;
|
||
|
|
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
|
||
|
|
$smarty->assign('cust_names', array('Joe Schmoe','Jack Smith','Jane
|
||
|
|
Johnson','Carlie Brown'));
|
||
|
|
$smarty->assign('customer_id', 1001);
|
||
|
|
$smarty->display('index.tpl');
|
||
|
|
|
||
|
|
|
||
|
|
index.tpl:
|
||
|
|
|
||
|
|
{html_radios values=$cust_ids selected=$customer_id output=$cust_names separator="<br />"}
|
||
|
|
|
||
|
|
|
||
|
|
index.php:
|
||
|
|
|
||
|
|
require('Smarty.class.php');
|
||
|
|
$smarty = new Smarty;
|
||
|
|
$smarty->assign('cust_radios', array(
|
||
|
|
1001 => 'Joe Schmoe',
|
||
|
|
1002 => 'Jack Smith',
|
||
|
|
1003 => 'Jane Johnson',
|
||
|
|
1004 => 'Charlie Brown'));
|
||
|
|
$smarty->assign('customer_id', 1001);
|
||
|
|
$smarty->display('index.tpl');
|
||
|
|
|
||
|
|
|
||
|
|
index.tpl:
|
||
|
|
|
||
|
|
{html_radios name="id" options=$cust_radios selected=$customer_id separator="<br />"}
|
||
|
|
|
||
|
|
|
||
|
|
OUTPUT: (both examples)
|
||
|
|
|
||
|
|
<input type="radio" name="id[]" value="1000">Joe Schmoe<br />
|
||
|
|
<input type="radio" name="id[]" value="1001" checked="checked"><br />
|
||
|
|
<input type="radio" name="id[]" value="1002">Jane Johnson<br />
|
||
|
|
<input type="radio" name="id[]" value="1003">Charlie Brown<br /></programlisting>
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.html.select.date">
|
||
|
|
<title>html_select_date</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>prefix</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>Date_</entry>
|
||
|
|
<entry>what to prefix the var name with</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>time</entry>
|
||
|
|
<entry>timestamp/YYYY-MM-DD</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>current time in unix timestamp or YYYY-MM-DD
|
||
|
|
format</entry>
|
||
|
|
<entry>what date/time to use</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>start_year</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>current year</entry>
|
||
|
|
<entry>the first year in the dropdown, either
|
||
|
|
year number, or relative to current year (+/- N)</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>end_year</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>same as start_year</entry>
|
||
|
|
<entry>the last year in the dropdown, either
|
||
|
|
year number, or relative to current year (+/- N)</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>display_days</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>true</entry>
|
||
|
|
<entry>whether to display days or not</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>display_months</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>true</entry>
|
||
|
|
<entry>whether to display months or not</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>display_years</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>true</entry>
|
||
|
|
<entry>whether to display years or not</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>month_format</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>%B</entry>
|
||
|
|
<entry>what format the month should be in (strftime)</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>day_format</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>%02d</entry>
|
||
|
|
<entry>what format the day output should be in (sprintf)</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>day_value_format</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>%d</entry>
|
||
|
|
<entry>what format the day value should be in (sprintf)</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>year_as_text</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>false</entry>
|
||
|
|
<entry>whether or not to display the year as text</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>reverse_years</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>false</entry>
|
||
|
|
<entry>display years in reverse order</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>field_array</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>null</entry>
|
||
|
|
<entry>
|
||
|
|
if a name is given, the select boxes will be drawn
|
||
|
|
such that the results will be returned to PHP in the
|
||
|
|
form of name[Day], name[Year], name[Month].
|
||
|
|
</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>day_size</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>null</entry>
|
||
|
|
<entry>adds size attribute to select tag if given</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>month_size</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>null</entry>
|
||
|
|
<entry>adds size attribute to select tag if given</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>year_size</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>null</entry>
|
||
|
|
<entry>adds size attribute to select tag if given</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>all_extra</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>null</entry>
|
||
|
|
<entry>adds extra attributes to all select/input tags if
|
||
|
|
given</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>day_extra</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>null</entry>
|
||
|
|
<entry>adds extra attributes to select/input tags if
|
||
|
|
given</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>month_extra</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>null</entry>
|
||
|
|
<entry>adds extra attributes to select/input tags if
|
||
|
|
given</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>year_extra</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>null</entry>
|
||
|
|
<entry>adds extra attributes to select/input tags if
|
||
|
|
given</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>field_order</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>MDY</entry>
|
||
|
|
<entry>the order in which to display the fields</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>field_separator</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>\n</entry>
|
||
|
|
<entry>string printed between different fields</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>month_value_format</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>%m</entry>
|
||
|
|
<entry>strftime format of the month values, default is
|
||
|
|
%m for month numbers.</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>year_empty</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>null</entry>
|
||
|
|
<entry>If supplied then the first element of the year's select-box has this
|
||
|
|
value as it's label and "" as it's value. This is useful to make the
|
||
|
|
select-box read "Please select a year" for example.</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>day_empty</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>null</entry>
|
||
|
|
<entry>If supplied then the first element of the day's select-box has this
|
||
|
|
value as it's label and "" as it's value.</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>month_empty</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>null</entry>
|
||
|
|
<entry>If supplied then the first element of the month's select-box has this
|
||
|
|
value as it's label and "" as it's value. .</entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
html_select_date is a custom function that creates date dropdowns
|
||
|
|
for you. It can display any or all of year, month, and day.
|
||
|
|
</para>
|
||
|
|
<example>
|
||
|
|
<title>html_select_date</title>
|
||
|
|
<programlisting>
|
||
|
|
{html_select_date}
|
||
|
|
|
||
|
|
|
||
|
|
OUTPUT:
|
||
|
|
|
||
|
|
<select name="Date_Month">
|
||
|
|
<option value="1">January</option>
|
||
|
|
<option value="2">February</option>
|
||
|
|
<option value="3">March</option>
|
||
|
|
<option value="4">April</option>
|
||
|
|
<option value="5">May</option>
|
||
|
|
<option value="6">June</option>
|
||
|
|
<option value="7">July</option>
|
||
|
|
<option value="8">August</option>
|
||
|
|
<option value="9">September</option>
|
||
|
|
<option value="10">October</option>
|
||
|
|
<option value="11">November</option>
|
||
|
|
<option value="12" selected>December</option>
|
||
|
|
</select>
|
||
|
|
<select name="Date_Day">
|
||
|
|
<option value="1">01</option>
|
||
|
|
<option value="2">02</option>
|
||
|
|
<option value="3">03</option>
|
||
|
|
<option value="4">04</option>
|
||
|
|
<option value="5">05</option>
|
||
|
|
<option value="6">06</option>
|
||
|
|
<option value="7">07</option>
|
||
|
|
<option value="8">08</option>
|
||
|
|
<option value="9">09</option>
|
||
|
|
<option value="10">10</option>
|
||
|
|
<option value="11">11</option>
|
||
|
|
<option value="12">12</option>
|
||
|
|
<option value="13" selected>13</option>
|
||
|
|
<option value="14">14</option>
|
||
|
|
<option value="15">15</option>
|
||
|
|
<option value="16">16</option>
|
||
|
|
<option value="17">17</option>
|
||
|
|
<option value="18">18</option>
|
||
|
|
<option value="19">19</option>
|
||
|
|
<option value="20">20</option>
|
||
|
|
<option value="21">21</option>
|
||
|
|
<option value="22">22</option>
|
||
|
|
<option value="23">23</option>
|
||
|
|
<option value="24">24</option>
|
||
|
|
<option value="25">25</option>
|
||
|
|
<option value="26">26</option>
|
||
|
|
<option value="27">27</option>
|
||
|
|
<option value="28">28</option>
|
||
|
|
<option value="29">29</option>
|
||
|
|
<option value="30">30</option>
|
||
|
|
<option value="31">31</option>
|
||
|
|
</select>
|
||
|
|
<select name="Date_Year">
|
||
|
|
<option value="2001" selected>2001</option>
|
||
|
|
</select></programlisting>
|
||
|
|
</example>
|
||
|
|
|
||
|
|
|
||
|
|
<example>
|
||
|
|
<title>html_select_date</title>
|
||
|
|
<programlisting>
|
||
|
|
|
||
|
|
{* start and end year can be relative to current year *}
|
||
|
|
{html_select_date prefix="StartDate" time=$time start_year="-5" end_year="+1" display_days=false}
|
||
|
|
|
||
|
|
OUTPUT: (current year is 2000)
|
||
|
|
|
||
|
|
<select name="StartDateMonth">
|
||
|
|
<option value="1">January</option>
|
||
|
|
<option value="2">February</option>
|
||
|
|
<option value="3">March</option>
|
||
|
|
<option value="4">April</option>
|
||
|
|
<option value="5">May</option>
|
||
|
|
<option value="6">June</option>
|
||
|
|
<option value="7">July</option>
|
||
|
|
<option value="8">August</option>
|
||
|
|
<option value="9">September</option>
|
||
|
|
<option value="10">October</option>
|
||
|
|
<option value="11">November</option>
|
||
|
|
<option value="12" selected>December</option>
|
||
|
|
</select>
|
||
|
|
<select name="StartDateYear">
|
||
|
|
<option value="1999">1995</option>
|
||
|
|
<option value="1999">1996</option>
|
||
|
|
<option value="1999">1997</option>
|
||
|
|
<option value="1999">1998</option>
|
||
|
|
<option value="1999">1999</option>
|
||
|
|
<option value="2000" selected>2000</option>
|
||
|
|
<option value="2001">2001</option>
|
||
|
|
</select></programlisting>
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.html.select.time">
|
||
|
|
<title>html_select_time</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>prefix</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>Time_</entry>
|
||
|
|
<entry>what to prefix the var name with</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>time</entry>
|
||
|
|
<entry>timestamp</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>current time</entry>
|
||
|
|
<entry>what date/time to use</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>display_hours</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>true</entry>
|
||
|
|
<entry>whether or not to display hours</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>display_minutes</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>true</entry>
|
||
|
|
<entry>whether or not to display minutes</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>display_seconds</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>true</entry>
|
||
|
|
<entry>whether or not to display seconds</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>display_meridian</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>true</entry>
|
||
|
|
<entry>whether or not to display meridian (am/pm)</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>use_24_hours</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>true</entry>
|
||
|
|
<entry>whether or not to use 24 hour clock</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>minute_interval</entry>
|
||
|
|
<entry>integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>1</entry>
|
||
|
|
<entry>number interval in minute dropdown</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>second_interval</entry>
|
||
|
|
<entry>integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>1</entry>
|
||
|
|
<entry>number interval in second dropdown</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>field_array</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>n/a</entry>
|
||
|
|
<entry>outputs values to array of this name</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>all_extra</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>null</entry>
|
||
|
|
<entry>adds extra attributes to select/input tags if
|
||
|
|
given</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>hour_extra</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>null</entry>
|
||
|
|
<entry>adds extra attributes to select/input tags if
|
||
|
|
given</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>minute_extra</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>null</entry>
|
||
|
|
<entry>adds extra attributes to select/input tags if
|
||
|
|
given</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>second_extra</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>null</entry>
|
||
|
|
<entry>adds extra attributes to select/input tags if
|
||
|
|
given</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>meridian_extra</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry>null</entry>
|
||
|
|
<entry>adds extra attributes to select/input tags if
|
||
|
|
given</entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
html_select_time is a custom function that
|
||
|
|
creates time dropdowns for you. It can display
|
||
|
|
any or all of hour, minute, second and
|
||
|
|
meridian.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
The time-attribute can have different
|
||
|
|
formats. It can be a uniq-timestamp or a
|
||
|
|
string containing Y-M-D. YYYY-MM-DD may be the
|
||
|
|
most common, but months and days with less
|
||
|
|
than two digits are also recognized. If one of
|
||
|
|
the 3 values (Y,M,D) is the empty string, than
|
||
|
|
the according select-box is not pre-selected
|
||
|
|
at all. This is especially useful with the
|
||
|
|
empty_year-, -month- and -day-attritbutes.
|
||
|
|
</para>
|
||
|
|
|
||
|
|
<example>
|
||
|
|
<title>html_select_time</title>
|
||
|
|
<programlisting>
|
||
|
|
{html_select_time use_24_hours=true}
|
||
|
|
|
||
|
|
|
||
|
|
OUTPUT:
|
||
|
|
|
||
|
|
<select name="Time_Hour">
|
||
|
|
<option value="00">00</option>
|
||
|
|
<option value="01">01</option>
|
||
|
|
<option value="02">02</option>
|
||
|
|
<option value="03">03</option>
|
||
|
|
<option value="04">04</option>
|
||
|
|
<option value="05">05</option>
|
||
|
|
<option value="06">06</option>
|
||
|
|
<option value="07">07</option>
|
||
|
|
<option value="08">08</option>
|
||
|
|
<option value="09" selected>09</option>
|
||
|
|
<option value="10">10</option>
|
||
|
|
<option value="11">11</option>
|
||
|
|
<option value="12">12</option>
|
||
|
|
<option value="13">13</option>
|
||
|
|
<option value="14">14</option>
|
||
|
|
<option value="15">15</option>
|
||
|
|
<option value="16">16</option>
|
||
|
|
<option value="17">17</option>
|
||
|
|
<option value="18">18</option>
|
||
|
|
<option value="19">19</option>
|
||
|
|
<option value="20">20</option>
|
||
|
|
<option value="21">21</option>
|
||
|
|
<option value="22">22</option>
|
||
|
|
<option value="23">23</option>
|
||
|
|
</select>
|
||
|
|
<select name="Time_Minute">
|
||
|
|
<option value="00">00</option>
|
||
|
|
<option value="01">01</option>
|
||
|
|
<option value="02">02</option>
|
||
|
|
<option value="03">03</option>
|
||
|
|
<option value="04">04</option>
|
||
|
|
<option value="05">05</option>
|
||
|
|
<option value="06">06</option>
|
||
|
|
<option value="07">07</option>
|
||
|
|
<option value="08">08</option>
|
||
|
|
<option value="09">09</option>
|
||
|
|
<option value="10">10</option>
|
||
|
|
<option value="11">11</option>
|
||
|
|
<option value="12">12</option>
|
||
|
|
<option value="13">13</option>
|
||
|
|
<option value="14">14</option>
|
||
|
|
<option value="15">15</option>
|
||
|
|
<option value="16">16</option>
|
||
|
|
<option value="17">17</option>
|
||
|
|
<option value="18">18</option>
|
||
|
|
<option value="19">19</option>
|
||
|
|
<option value="20" selected>20</option>
|
||
|
|
<option value="21">21</option>
|
||
|
|
<option value="22">22</option>
|
||
|
|
<option value="23">23</option>
|
||
|
|
<option value="24">24</option>
|
||
|
|
<option value="25">25</option>
|
||
|
|
<option value="26">26</option>
|
||
|
|
<option value="27">27</option>
|
||
|
|
<option value="28">28</option>
|
||
|
|
<option value="29">29</option>
|
||
|
|
<option value="30">30</option>
|
||
|
|
<option value="31">31</option>
|
||
|
|
<option value="32">32</option>
|
||
|
|
<option value="33">33</option>
|
||
|
|
<option value="34">34</option>
|
||
|
|
<option value="35">35</option>
|
||
|
|
<option value="36">36</option>
|
||
|
|
<option value="37">37</option>
|
||
|
|
<option value="38">38</option>
|
||
|
|
<option value="39">39</option>
|
||
|
|
<option value="40">40</option>
|
||
|
|
<option value="41">41</option>
|
||
|
|
<option value="42">42</option>
|
||
|
|
<option value="43">43</option>
|
||
|
|
<option value="44">44</option>
|
||
|
|
<option value="45">45</option>
|
||
|
|
<option value="46">46</option>
|
||
|
|
<option value="47">47</option>
|
||
|
|
<option value="48">48</option>
|
||
|
|
<option value="49">49</option>
|
||
|
|
<option value="50">50</option>
|
||
|
|
<option value="51">51</option>
|
||
|
|
<option value="52">52</option>
|
||
|
|
<option value="53">53</option>
|
||
|
|
<option value="54">54</option>
|
||
|
|
<option value="55">55</option>
|
||
|
|
<option value="56">56</option>
|
||
|
|
<option value="57">57</option>
|
||
|
|
<option value="58">58</option>
|
||
|
|
<option value="59">59</option>
|
||
|
|
</select>
|
||
|
|
<select name="Time_Second">
|
||
|
|
<option value="00">00</option>
|
||
|
|
<option value="01">01</option>
|
||
|
|
<option value="02">02</option>
|
||
|
|
<option value="03">03</option>
|
||
|
|
<option value="04">04</option>
|
||
|
|
<option value="05">05</option>
|
||
|
|
<option value="06">06</option>
|
||
|
|
<option value="07">07</option>
|
||
|
|
<option value="08">08</option>
|
||
|
|
<option value="09">09</option>
|
||
|
|
<option value="10">10</option>
|
||
|
|
<option value="11">11</option>
|
||
|
|
<option value="12">12</option>
|
||
|
|
<option value="13">13</option>
|
||
|
|
<option value="14">14</option>
|
||
|
|
<option value="15">15</option>
|
||
|
|
<option value="16">16</option>
|
||
|
|
<option value="17">17</option>
|
||
|
|
<option value="18">18</option>
|
||
|
|
<option value="19">19</option>
|
||
|
|
<option value="20">20</option>
|
||
|
|
<option value="21">21</option>
|
||
|
|
<option value="22">22</option>
|
||
|
|
<option value="23" selected>23</option>
|
||
|
|
<option value="24">24</option>
|
||
|
|
<option value="25">25</option>
|
||
|
|
<option value="26">26</option>
|
||
|
|
<option value="27">27</option>
|
||
|
|
<option value="28">28</option>
|
||
|
|
<option value="29">29</option>
|
||
|
|
<option value="30">30</option>
|
||
|
|
<option value="31">31</option>
|
||
|
|
<option value="32">32</option>
|
||
|
|
<option value="33">33</option>
|
||
|
|
<option value="34">34</option>
|
||
|
|
<option value="35">35</option>
|
||
|
|
<option value="36">36</option>
|
||
|
|
<option value="37">37</option>
|
||
|
|
<option value="38">38</option>
|
||
|
|
<option value="39">39</option>
|
||
|
|
<option value="40">40</option>
|
||
|
|
<option value="41">41</option>
|
||
|
|
<option value="42">42</option>
|
||
|
|
<option value="43">43</option>
|
||
|
|
<option value="44">44</option>
|
||
|
|
<option value="45">45</option>
|
||
|
|
<option value="46">46</option>
|
||
|
|
<option value="47">47</option>
|
||
|
|
<option value="48">48</option>
|
||
|
|
<option value="49">49</option>
|
||
|
|
<option value="50">50</option>
|
||
|
|
<option value="51">51</option>
|
||
|
|
<option value="52">52</option>
|
||
|
|
<option value="53">53</option>
|
||
|
|
<option value="54">54</option>
|
||
|
|
<option value="55">55</option>
|
||
|
|
<option value="56">56</option>
|
||
|
|
<option value="57">57</option>
|
||
|
|
<option value="58">58</option>
|
||
|
|
<option value="59">59</option>
|
||
|
|
</select>
|
||
|
|
<select name="Time_Meridian">
|
||
|
|
<option value="am" selected>AM</option>
|
||
|
|
<option value="pm">PM</option>
|
||
|
|
</select></programlisting>
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.html.table">
|
||
|
|
<title>html_table</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>loop</entry>
|
||
|
|
<entry>array</entry>
|
||
|
|
<entry>Yes</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>array of data to loop through</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>cols</entry>
|
||
|
|
<entry>integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>3</emphasis></entry>
|
||
|
|
<entry>number of columns in the table</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>table_attr</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>border="1"</emphasis></entry>
|
||
|
|
<entry>attributes for table tag</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>tr_attr</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>empty</emphasis></entry>
|
||
|
|
<entry>attributes for tr tag (arrays are cycled)</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>td_attr</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>empty</emphasis></entry>
|
||
|
|
<entry>attributes for td tag (arrays are cycled)</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>trailpad</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>&nbsp;</emphasis></entry>
|
||
|
|
<entry>value to pad the trailing cells on last row with
|
||
|
|
(if any)</entry>
|
||
|
|
</row>
|
||
|
|
|
||
|
|
<row>
|
||
|
|
<entry>hdir</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>right</emphasis></entry>
|
||
|
|
<entry>direction of one row to be rendered. possible values: <emphasis>left</emphasis>/<emphasis>right</emphasis></entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>vdir</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>down</emphasis></entry>
|
||
|
|
<entry>direction of the columns to be rendered. possible values: <emphasis>up</emphasis>/<emphasis>down</emphasis></entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
<emphasis>html_table</emphasis> is a custom function that dumps an
|
||
|
|
array of data into an HTML table. The <emphasis>cols</emphasis>
|
||
|
|
attribute determines how many columns will be in the table. The
|
||
|
|
<emphasis>table_attr</emphasis>, <emphasis>tr_attr</emphasis> and
|
||
|
|
<emphasis>td_attr</emphasis> values determine the attributes given
|
||
|
|
to the table, tr and td tags. If <emphasis>tr_attr</emphasis> or
|
||
|
|
<emphasis>td_attr</emphasis> are arrays, they will be cycled through.
|
||
|
|
<emphasis>trailpad</emphasis> is the value put into the trailing
|
||
|
|
cells on the last table row if there are any present.
|
||
|
|
</para>
|
||
|
|
<example>
|
||
|
|
<title>html_table</title>
|
||
|
|
<programlisting>
|
||
|
|
<![CDATA[
|
||
|
|
index.php:
|
||
|
|
|
||
|
|
require('Smarty.class.php');
|
||
|
|
$smarty = new Smarty;
|
||
|
|
$smarty->assign('data',array(1,2,3,4,5,6,7,8,9));
|
||
|
|
$smarty->assign('tr',array('bgcolor="#eeeeee"','bgcolor="#dddddd"'));
|
||
|
|
$smarty->display('index.tpl');
|
||
|
|
|
||
|
|
index.tpl:
|
||
|
|
|
||
|
|
{html_table loop=$data}
|
||
|
|
{html_table loop=$data cols=4 table_attr='border="0"'}
|
||
|
|
{html_table loop=$data cols=4 tr_attr=$tr}
|
||
|
|
|
||
|
|
OUTPUT:
|
||
|
|
|
||
|
|
<table border="1">
|
||
|
|
<tr><td>1</td><td>2</td><td>3</td></tr>
|
||
|
|
<tr><td>4</td><td>5</td><td>6</td></tr>
|
||
|
|
<tr><td>7</td><td>8</td><td>9</td></tr>
|
||
|
|
</table>
|
||
|
|
<table border="0">
|
||
|
|
<tr><td>1</td><td>2</td><td>3</td><td>4</td></tr>
|
||
|
|
<tr><td>5</td><td>6</td><td>7</td><td>8</td></tr>
|
||
|
|
<tr><td>9</td><td> </td><td> </td><td> </td></tr>
|
||
|
|
</table>
|
||
|
|
<table border="1">
|
||
|
|
<tr bgcolor="#eeeeee"><td>1</td><td>2</td><td>3</td><td>4</td></tr>
|
||
|
|
<tr bgcolor="#dddddd"><td>5</td><td>6</td><td>7</td><td>8</td></tr>
|
||
|
|
<tr bgcolor="#eeeeee"><td>9</td><td> </td><td> </td><td> </td></tr>
|
||
|
|
</table>
|
||
|
|
]]></programlisting>
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.math">
|
||
|
|
<title>math</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>equation</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>Yes</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>the equation to execute</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>format</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>the format of the result (sprintf)</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>var</entry>
|
||
|
|
<entry>numeric</entry>
|
||
|
|
<entry>Yes</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>equation variable value</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>assign</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>template variable the output will be assigned to</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>[var ...]</entry>
|
||
|
|
<entry>numeric</entry>
|
||
|
|
<entry>Yes</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>equation variable value</entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
math allows the template designer to do math equations in the
|
||
|
|
template. Any numeric template variables may be used in the
|
||
|
|
equations, and the result is printed in place of the tag. The
|
||
|
|
variables used in the equation are passed as parameters, which can
|
||
|
|
be template variables or static values. +, -, /, *, abs, ceil, cos,
|
||
|
|
exp, floor, log, log10, max, min, pi, pow, rand, round, sin, sqrt,
|
||
|
|
srans and tan are all valid operators. Check the PHP documentation
|
||
|
|
for further information on these math functions.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
If you supply the special "assign" attribute, the output of the
|
||
|
|
math function will be assigned to this template variable instead of
|
||
|
|
being output to the template.
|
||
|
|
</para>
|
||
|
|
<note>
|
||
|
|
<title>Technical Note</title>
|
||
|
|
<para>
|
||
|
|
math is an expensive function in performance due to its use of
|
||
|
|
the php eval() function. Doing the math in PHP is much more
|
||
|
|
efficient, so whenever possible do the math calculations in PHP
|
||
|
|
and assign the results to the template. Definately avoid
|
||
|
|
repetitive math function calls, like within section loops.
|
||
|
|
</para>
|
||
|
|
</note>
|
||
|
|
<example>
|
||
|
|
<title>math</title>
|
||
|
|
<programlisting>
|
||
|
|
{* $height=4, $width=5 *}
|
||
|
|
|
||
|
|
{math equation="x + y" x=$height y=$width}
|
||
|
|
|
||
|
|
OUTPUT:
|
||
|
|
|
||
|
|
9
|
||
|
|
|
||
|
|
|
||
|
|
{* $row_height = 10, $row_width = 20, #col_div# = 2, assigned in template *}
|
||
|
|
|
||
|
|
{math equation="height * width / division"
|
||
|
|
height=$row_height
|
||
|
|
width=$row_width
|
||
|
|
division=#col_div#}
|
||
|
|
|
||
|
|
OUTPUT:
|
||
|
|
|
||
|
|
100
|
||
|
|
|
||
|
|
|
||
|
|
{* you can use parenthesis *}
|
||
|
|
|
||
|
|
{math equation="(( x + y ) / z )" x=2 y=10 z=2}
|
||
|
|
|
||
|
|
OUTPUT:
|
||
|
|
|
||
|
|
6
|
||
|
|
|
||
|
|
|
||
|
|
{* you can supply a format parameter in sprintf format *}
|
||
|
|
|
||
|
|
{math equation="x + y" x=4.4444 y=5.0000 format="%.2f"}
|
||
|
|
|
||
|
|
OUTPUT:
|
||
|
|
|
||
|
|
9.44</programlisting>
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.mailto">
|
||
|
|
<title>mailto</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>address</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>Yes</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>the e-mail address</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>text</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>the text to display, default is
|
||
|
|
the e-mail address</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>encode</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>none</emphasis></entry>
|
||
|
|
<entry>How to encode the e-mail.
|
||
|
|
Can be one of none,
|
||
|
|
hex or javascript.</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>cc</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>e-mail addresses to carbon copy.
|
||
|
|
Separate entries by a comma.</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>bcc</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>e-mail addresses to blind carbon copy.
|
||
|
|
Separate entries by a comma.</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>subject</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>e-mail subject.</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>newsgroups</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>newsgroups to post to.
|
||
|
|
Separate entries by a comma.</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>followupto</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>addresses to follow up to.
|
||
|
|
Separate entries by a comma.</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>extra</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>any extra information you
|
||
|
|
want passed to the link, such
|
||
|
|
as style sheet classes</entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
mailto automates the creation of mailto links and optionally
|
||
|
|
encodes them. Encoding e-mails makes it more difficult for
|
||
|
|
web spiders to pick up e-mail addresses off of your site.
|
||
|
|
</para>
|
||
|
|
<note>
|
||
|
|
<title>Technical Note</title>
|
||
|
|
<para>
|
||
|
|
javascript is probably the most thorough form of
|
||
|
|
encoding, although you can use hex encoding too.
|
||
|
|
</para>
|
||
|
|
</note>
|
||
|
|
<example>
|
||
|
|
<title>mailto</title>
|
||
|
|
<programlisting>
|
||
|
|
{mailto address="me@domain.com"}
|
||
|
|
{mailto address="me@domain.com" text="send me some mail"}
|
||
|
|
{mailto address="me@domain.com" encode="javascript"}
|
||
|
|
{mailto address="me@domain.com" encode="hex"}
|
||
|
|
{mailto address="me@domain.com" subject="Hello to you!"}
|
||
|
|
{mailto address="me@domain.com" cc="you@domain.com,they@domain.com"}
|
||
|
|
{mailto address="me@domain.com" extra='class="email"'}
|
||
|
|
|
||
|
|
OUTPUT:
|
||
|
|
|
||
|
|
<a href="mailto:me@domain.com" >me@domain.com</a>
|
||
|
|
<a href="mailto:me@domain.com" >send me some mail</a>
|
||
|
|
<script type="text/javascript" language="javascript">eval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%6
|
||
|
|
9%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%
|
||
|
|
61%69%6e%2e%63%6f%6d%22%20%3e%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%3c%2f%61%3e
|
||
|
|
%27%29%3b'))</script>
|
||
|
|
<a href="mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d" >me@domain.com</a>
|
||
|
|
<a href="mailto:me@domain.com?subject=Hello%20to%20you%21" >me@domain.com</a>
|
||
|
|
<a href="mailto:me@domain.com?cc=you@domain.com%2Cthey@domain.com" >me@domain.com</a>
|
||
|
|
<a href="mailto:me@domain.com" class="email">me@domain.com</a></programlisting>
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.popup.init">
|
||
|
|
<title>popup_init</title>
|
||
|
|
<para>
|
||
|
|
popup is an integration of overLib, a library used for popup
|
||
|
|
windows. These are used for context sensitive information, such as
|
||
|
|
help windows or tooltips. popup_init must be called once at the
|
||
|
|
top of any page you plan on using the <link
|
||
|
|
linkend="language.function.popup">popup</link> function. overLib
|
||
|
|
was written by Erik Bosrup, and the homepage is located at
|
||
|
|
http://www.bosrup.com/web/overlib/.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
As of Smarty version 2.1.2, overLib does NOT come with the release.
|
||
|
|
Download overLib, place the overlib.js file under your document
|
||
|
|
root and supply the relative path to this file as the "src"
|
||
|
|
parameter to popup_init.
|
||
|
|
</para>
|
||
|
|
<example>
|
||
|
|
<title>popup_init</title>
|
||
|
|
<programlisting>
|
||
|
|
{* popup_init must be called once at the top of the page *}
|
||
|
|
{popup_init src="/javascripts/overlib.js"}</programlisting>
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.popup">
|
||
|
|
<title>popup</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>text</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>Yes</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>the text/html to display in the popup window</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>trigger</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>onMouseOver</emphasis></entry>
|
||
|
|
<entry>What is used to trigger the popup window. Can be
|
||
|
|
one of onMouseOver or onClick</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>sticky</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>false</emphasis></entry>
|
||
|
|
<entry>Makes the popup stick around until closed</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>caption</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets the caption to title</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>fgcolor</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>color of the inside of the popup box</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>bgcolor</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>color of the border of the popup box</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>textcolor</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets the color of the text inside the box</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>capcolor</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets color of the box's caption</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>closecolor</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets the color of the close text</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>textfont</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets the font to be used by the main text</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>captionfont</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets the font of the caption</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>closefont</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets the font for the "Close" text</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>textsize</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets the size of the main text's font</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>captionsize</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets the size of the caption's font</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>closesize</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets the size of the "Close" text's font</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>width</entry>
|
||
|
|
<entry>integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets the width of the box</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>height</entry>
|
||
|
|
<entry>integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets the height of the box</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>left</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>false</emphasis></entry>
|
||
|
|
<entry>makes the popups go to the left of the mouse</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>right</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>false</emphasis></entry>
|
||
|
|
<entry>makes the popups go to the right of the mouse</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>center</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>false</emphasis></entry>
|
||
|
|
<entry>makes the popups go to the center of the mouse</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>above</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>false</emphasis></entry>
|
||
|
|
<entry>makes the popups go above the mouse. NOTE: only
|
||
|
|
possible when height has been set</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>below</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>false</emphasis></entry>
|
||
|
|
<entry>makes the popups go below the mouse</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>border</entry>
|
||
|
|
<entry>integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>makes the border of the popups thicker or thinner</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>offsetx</entry>
|
||
|
|
<entry>integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>how far away from the pointer the popup will show
|
||
|
|
up, horizontally</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>offsety</entry>
|
||
|
|
<entry>integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>how far away from the pointer the popup will show
|
||
|
|
up, vertically</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>fgbackground</entry>
|
||
|
|
<entry>url to image</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>defines a picture to use instead of color for the
|
||
|
|
inside of the popup.</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>bgbackground</entry>
|
||
|
|
<entry>url to image</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>defines a picture to use instead of color for the
|
||
|
|
border of the popup. NOTE: You will want to set bgcolor
|
||
|
|
to "" or the color will show as well. NOTE: When having
|
||
|
|
a Close link, Netscape will re-render the table cells,
|
||
|
|
making things look incorrect</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>closetext</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets the "Close" text to something else</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>noclose</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>does not display the "Close" text on stickies
|
||
|
|
with a caption</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>status</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets the text in the browsers status bar</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>autostatus</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets the status bar's text to the popup's text.
|
||
|
|
NOTE: overrides status setting</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>autostatuscap</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets the status bar's text to the caption's text.
|
||
|
|
NOTE: overrides status and autostatus settings</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>inarray</entry>
|
||
|
|
<entry>integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>tells overLib to read text from this index in
|
||
|
|
the ol_text array, located in overlib.js. This
|
||
|
|
parameter can be used instead of text</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>caparray</entry>
|
||
|
|
<entry>integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>tells overLib to read the caption from this index
|
||
|
|
in the ol_caps array</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>capicon</entry>
|
||
|
|
<entry>url</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>displays the image given before the popup caption</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>snapx</entry>
|
||
|
|
<entry>integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>snaps the popup to an even position in a
|
||
|
|
horizontal grid</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>snapy</entry>
|
||
|
|
<entry>integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>snaps the popup to an even position in a
|
||
|
|
vertical grid</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>fixx</entry>
|
||
|
|
<entry>integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>locks the popups horizontal position Note:
|
||
|
|
overrides all other horizontal placement</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>fixy</entry>
|
||
|
|
<entry>integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>locks the popups vertical position Note:
|
||
|
|
overrides all other vertical placement</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>background</entry>
|
||
|
|
<entry>url</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>sets image to be used instead of table box
|
||
|
|
background</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>padx</entry>
|
||
|
|
<entry>integer,integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>pads the background image with horizontal
|
||
|
|
whitespace for text placement. Note: this is a two
|
||
|
|
parameter command</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>pady</entry>
|
||
|
|
<entry>integer,integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>pads the background image with vertical
|
||
|
|
whitespace for text placement. Note: this is a two
|
||
|
|
parameter command</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>fullhtml</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>allows you to control the html over a background
|
||
|
|
picture completely. The html code is expected in the "text"
|
||
|
|
attribute</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>frame</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>controls popups in a different frame. See the
|
||
|
|
overlib page for more info on this function</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>timeout</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>calls the specified javascript function and takes
|
||
|
|
the return value as the text that should be displayed in
|
||
|
|
the popup window</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>delay</entry>
|
||
|
|
<entry>integer</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>makes that popup behave like a tooltip. It will
|
||
|
|
popup only after this delay in milliseconds</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>hauto</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>automatically determine if the popup should be to
|
||
|
|
the left or right of the mouse.</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>vauto</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>automatically determine if the popup should be
|
||
|
|
above or below the mouse.</entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
popup is used to create javascript popup windows.
|
||
|
|
</para>
|
||
|
|
<example>
|
||
|
|
<title>popup</title>
|
||
|
|
<programlisting>
|
||
|
|
{* popup_init must be called once at the top of the page *}
|
||
|
|
{popup_init src="/javascripts/overlib.js"}
|
||
|
|
|
||
|
|
{* create a link with a popup window when you move your mouse over *}
|
||
|
|
<A href="mypage.html" {popup text="This link takes you to my page!"}>mypage</A>
|
||
|
|
|
||
|
|
{* you can use html, links, etc in your popup text *}
|
||
|
|
<A href="mypage.html" {popup sticky=true caption="mypage contents"
|
||
|
|
text="<UL><LI>links<LI>pages<LI>images</UL>" snapx=10 snapy=10}>mypage</A></programlisting>
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
<sect1 id="language.function.textformat">
|
||
|
|
<title>textformat</title>
|
||
|
|
<informaltable frame="all">
|
||
|
|
<tgroup cols="5">
|
||
|
|
<colspec colname="param" align="center" />
|
||
|
|
<colspec colname="type" align="center" />
|
||
|
|
<colspec colname="required" align="center" />
|
||
|
|
<colspec colname="default" align="center" />
|
||
|
|
<colspec colname="desc" />
|
||
|
|
<thead>
|
||
|
|
<row>
|
||
|
|
<entry>Attribute Name</entry>
|
||
|
|
<entry>Type</entry>
|
||
|
|
<entry>Required</entry>
|
||
|
|
<entry>Default</entry>
|
||
|
|
<entry>Description</entry>
|
||
|
|
</row>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<row>
|
||
|
|
<entry>style</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>preset style</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>indent</entry>
|
||
|
|
<entry>number</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>0</emphasis></entry>
|
||
|
|
<entry>The number of chars to indent every line</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>indent_first</entry>
|
||
|
|
<entry>number</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>0</emphasis></entry>
|
||
|
|
<entry>The number of chars to indent the first line</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>indent_char</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>(single space)</emphasis></entry>
|
||
|
|
<entry>The character (or string of chars) to indent with</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>wrap</entry>
|
||
|
|
<entry>number</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>80</emphasis></entry>
|
||
|
|
<entry>How many characters to wrap each line to</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>wrap_char</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>\n</emphasis></entry>
|
||
|
|
<entry>The character (or string of chars) to break each
|
||
|
|
line with</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>wrap_cut</entry>
|
||
|
|
<entry>boolean</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>false</emphasis></entry>
|
||
|
|
<entry>If true, wrap will break the line at the exact
|
||
|
|
character instead of at a word boundary</entry>
|
||
|
|
</row>
|
||
|
|
<row>
|
||
|
|
<entry>assign</entry>
|
||
|
|
<entry>string</entry>
|
||
|
|
<entry>No</entry>
|
||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
||
|
|
<entry>the template variable the output will be assigned
|
||
|
|
to</entry>
|
||
|
|
</row>
|
||
|
|
</tbody>
|
||
|
|
</tgroup>
|
||
|
|
</informaltable>
|
||
|
|
<para>
|
||
|
|
textformat is a block function used to format text. It basically
|
||
|
|
cleans up spaces and special characters, and formats paragraphs by
|
||
|
|
wrapping at a boundary and indenting lines.
|
||
|
|
</para>
|
||
|
|
<para>
|
||
|
|
You can set the parameters explicitly, or use a preset style.
|
||
|
|
Currently "email" is the only available style.
|
||
|
|
</para>
|
||
|
|
<example>
|
||
|
|
<title>textformat</title>
|
||
|
|
<programlisting>
|
||
|
|
{textformat wrap=40}
|
||
|
|
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
|
||
|
|
This is bar.
|
||
|
|
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
|
||
|
|
{/textformat}
|
||
|
|
|
||
|
|
OUTPUT:
|
||
|
|
|
||
|
|
This is foo. This is foo. This is foo.
|
||
|
|
This is foo. This is foo. This is foo.
|
||
|
|
|
||
|
|
This is bar.
|
||
|
|
|
||
|
|
bar foo bar foo foo. bar foo bar foo
|
||
|
|
foo. bar foo bar foo foo. bar foo bar
|
||
|
|
foo foo. bar foo bar foo foo. bar foo
|
||
|
|
bar foo foo. bar foo bar foo foo.
|
||
|
|
|
||
|
|
|
||
|
|
{textformat wrap=40 indent=4}
|
||
|
|
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
|
||
|
|
This is bar.
|
||
|
|
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
|
||
|
|
{/textformat}
|
||
|
|
|
||
|
|
OUTPUT:
|
||
|
|
|
||
|
|
This is foo. This is foo. This is
|
||
|
|
foo. This is foo. This is foo. This
|
||
|
|
is foo.
|
||
|
|
|
||
|
|
This is bar.
|
||
|
|
|
||
|
|
bar foo bar foo foo. bar foo bar foo
|
||
|
|
foo. bar foo bar foo foo. bar foo
|
||
|
|
bar foo foo. bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo. bar foo bar
|
||
|
|
foo foo.
|
||
|
|
|
||
|
|
{textformat wrap=40 indent=4 indent_first=4}
|
||
|
|
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
|
||
|
|
This is bar.
|
||
|
|
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
|
||
|
|
{/textformat}
|
||
|
|
|
||
|
|
OUTPUT:
|
||
|
|
|
||
|
|
This is foo. This is foo. This
|
||
|
|
is foo. This is foo. This is foo.
|
||
|
|
This is foo.
|
||
|
|
|
||
|
|
This is bar.
|
||
|
|
|
||
|
|
bar foo bar foo foo. bar foo bar
|
||
|
|
foo foo. bar foo bar foo foo. bar
|
||
|
|
foo bar foo foo. bar foo bar foo
|
||
|
|
foo. bar foo bar foo foo. bar foo
|
||
|
|
bar foo foo.
|
||
|
|
|
||
|
|
{textformat style="email"}
|
||
|
|
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
This is foo.
|
||
|
|
|
||
|
|
This is bar.
|
||
|
|
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
bar foo bar foo foo.
|
||
|
|
|
||
|
|
{/textformat}
|
||
|
|
|
||
|
|
OUTPUT:
|
||
|
|
|
||
|
|
This is foo. This is foo. This is foo. This is foo. This is foo. This is
|
||
|
|
foo.
|
||
|
|
|
||
|
|
This is bar.
|
||
|
|
|
||
|
|
bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo
|
||
|
|
bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo
|
||
|
|
foo.
|
||
|
|
|
||
|
|
</programlisting>
|
||
|
|
</example>
|
||
|
|
</sect1>
|
||
|
|
</chapter>
|
||
|
|
<!-- Keep this comment at the end of the file
|
||
|
|
Local variables:
|
||
|
|
mode: sgml
|
||
|
|
sgml-omittag:t
|
||
|
|
sgml-shorttag:t
|
||
|
|
sgml-minimize-attributes:nil
|
||
|
|
sgml-always-quote-attributes:t
|
||
|
|
sgml-indent-step:1
|
||
|
|
sgml-indent-data:t
|
||
|
|
indent-tabs-mode:nil
|
||
|
|
sgml-parent-document:nil
|
||
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
||
|
|
sgml-exposed-tags:nil
|
||
|
|
sgml-local-catalogs:nil
|
||
|
|
sgml-local-ecat-files:nil
|
||
|
|
End:
|
||
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||
|
|
vim: et tw=78 syn=sgml
|
||
|
|
vi: ts=1 sw=1
|
||
|
|
-->
|