* some wz

* no tab
* add Cdata section
# make test before commit ;)
This commit is contained in:
yannick
2005-05-10 21:14:36 +00:00
parent 9d92dc1613
commit 610b3aa2f0
7 changed files with 442 additions and 378 deletions

View File

@@ -1,56 +1,63 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<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>
<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>
<![CDATA[
{assign var="name" value="Bob"}
The value of $name is {$name}.
OUTPUT:
The value of $name is Bob.</programlisting>
</example>
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
The value of $name is Bob.
]]>
</screen>
</example>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:

View File

@@ -59,8 +59,7 @@
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>the template variable the output will be assigned
to</entry>
<entry>the template variable the output will be assigned to</entry>
</row>
</tbody>
</tgroup>

View File

@@ -82,7 +82,7 @@
{* assign the fetched contents to a template variable *}
{fetch file="http://www.myweather.com/68502/" assign="weather"}
{if $weather ne ""}
<b>{$weather}</b>
<b>{$weather}</b>
{/if}
]]>
</programlisting>

View File

@@ -95,7 +95,7 @@
<entry>No</entry>
<entry>null</entry>
<entry>adds extra attributes to select/input tags if
given</entry>
given</entry>
</row>
<row>
<entry>hour_extra</entry>
@@ -103,7 +103,7 @@
<entry>No</entry>
<entry>null</entry>
<entry>adds extra attributes to select/input tags if
given</entry>
given</entry>
</row>
<row>
<entry>minute_extra</entry>
@@ -111,7 +111,7 @@
<entry>No</entry>
<entry>null</entry>
<entry>adds extra attributes to select/input tags if
given</entry>
given</entry>
</row>
<row>
<entry>second_extra</entry>
@@ -119,7 +119,7 @@
<entry>No</entry>
<entry>null</entry>
<entry>adds extra attributes to select/input tags if
given</entry>
given</entry>
</row>
<row>
<entry>meridian_extra</entry>
@@ -127,7 +127,7 @@
<entry>No</entry>
<entry>null</entry>
<entry>adds extra attributes to select/input tags if
given</entry>
given</entry>
</row>
</tbody>
</tgroup>

View File

@@ -1,128 +1,153 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<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 *}
<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>
<![CDATA[
{* $height=4, $width=5 *}
{math equation="x + y" x=$height y=$width}
{math equation="x + y" x=$height y=$width}
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
9
]]>
</screen>
<programlisting>
<![CDATA[
{* $row_height = 10, $row_width = 20, #col_div# = 2, assigned in template *}
OUTPUT:
{math equation="height * width / division"
height=$row_height
width=$row_width
division=#col_div#}
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
100
]]>
</screen>
<programlisting>
<![CDATA[
{* you can use parenthesis *}
9
{math equation="(( x + y ) / z )" x=2 y=10 z=2}
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
6
]]>
</screen>
<programlisting>
<![CDATA[
{* you can supply a format parameter in sprintf format *}
{* $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>
{math equation="x + y" x=4.4444 y=5.0000 format="%.2f"}
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
9.44
]]>
</screen>
</example>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.popup">
<title>popup</title>
<title>popup</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -390,9 +390,9 @@
</tbody>
</tgroup>
</informaltable>
<para>
popup is used to create javascript popup windows.
</para>
<para>
popup is used to create javascript popup windows.
</para>
<example>
<title>popup</title>
<programlisting>

View File

@@ -1,236 +1,269 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<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}
<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>
<![CDATA[
{textformat wrap=40}
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
This is bar.
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.
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}
{/textformat}
OUTPUT:
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
This is foo. This is foo. This is foo.
This is foo. This is foo. This is foo.
This is foo. This is foo. This is foo.
This is foo. This is foo. This is foo.
This is bar.
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.
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.
]]>
</screen>
<programlisting>
<![CDATA[
{textformat wrap=40 indent=4}
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
{textformat wrap=40 indent=4}
This is bar.
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
This is 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.
bar foo bar foo foo.
This is bar.
{/textformat}
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>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
{/textformat}
This is foo. This is foo. This is
foo. This is foo. This is foo. This
is foo.
OUTPUT:
This is bar.
This is foo. This is foo. This is
foo. This is foo. This is foo. This
is 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. bar foo bar
foo foo.
]]>
</screen>
<programlisting>
<![CDATA[
{textformat wrap=40 indent=4 indent_first=4}
This is bar.
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
This is 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. bar foo bar
foo foo.
This is bar.
{textformat wrap=40 indent=4 indent_first=4}
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.
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
{/textformat}
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
This is bar.
This is foo. This is foo. This
is foo. This is foo. This is foo.
This is 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.
bar foo bar foo foo.
This is bar.
{/textformat}
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.
]]>
</screen>
<programlisting>
<![CDATA[
{textformat style="email"}
OUTPUT:
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
This is foo. This is foo. This
is foo. This is foo. This is foo.
This is foo.
This is bar.
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.
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}
{textformat style="email"}
]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
This is foo.
This is foo. This is foo. This is foo. This is foo. This is foo. This is
foo.
This is bar.
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.
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>
]]>
</screen>
</example>
</sect1>
<!-- Keep this comment at the end of the file
Local variables: