* 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"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.assign"> <sect1 id="language.function.assign">
<title>assign</title> <title>assign</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
<colspec colname="type" align="center" /> <colspec colname="type" align="center" />
<colspec colname="required" align="center" /> <colspec colname="required" align="center" />
<colspec colname="default" align="center" /> <colspec colname="default" align="center" />
<colspec colname="desc" /> <colspec colname="desc" />
<thead> <thead>
<row> <row>
<entry>Attribute Name</entry> <entry>Attribute Name</entry>
<entry>Type</entry> <entry>Type</entry>
<entry>Required</entry> <entry>Required</entry>
<entry>Default</entry> <entry>Default</entry>
<entry>Description</entry> <entry>Description</entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>var</entry> <entry>var</entry>
<entry>string</entry> <entry>string</entry>
<entry>Yes</entry> <entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>The name of the variable being assigned</entry> <entry>The name of the variable being assigned</entry>
</row> </row>
<row> <row>
<entry>value</entry> <entry>value</entry>
<entry>string</entry> <entry>string</entry>
<entry>Yes</entry> <entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>The value being assigned</entry> <entry>The value being assigned</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
assign is used for assigning template variables during the execution assign is used for assigning template variables during the execution
of the template. of the template.
</para> </para>
<example> <example>
<title>assign</title> <title>assign</title>
<programlisting> <programlisting>
<![CDATA[
{assign var="name" value="Bob"} {assign var="name" value="Bob"}
The value of $name is {$name}. The value of $name is {$name}.
]]>
OUTPUT: </programlisting>
<para>
The value of $name is Bob.</programlisting> The above example will output:
</example> </para>
<screen>
<![CDATA[
The value of $name is Bob.
]]>
</screen>
</example>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

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

View File

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

View File

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

View File

@@ -1,128 +1,153 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.math"> <sect1 id="language.function.math">
<title>math</title> <title>math</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
<colspec colname="type" align="center" /> <colspec colname="type" align="center" />
<colspec colname="required" align="center" /> <colspec colname="required" align="center" />
<colspec colname="default" align="center" /> <colspec colname="default" align="center" />
<colspec colname="desc" /> <colspec colname="desc" />
<thead> <thead>
<row> <row>
<entry>Attribute Name</entry> <entry>Attribute Name</entry>
<entry>Type</entry> <entry>Type</entry>
<entry>Required</entry> <entry>Required</entry>
<entry>Default</entry> <entry>Default</entry>
<entry>Description</entry> <entry>Description</entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>equation</entry> <entry>equation</entry>
<entry>string</entry> <entry>string</entry>
<entry>Yes</entry> <entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>the equation to execute</entry> <entry>the equation to execute</entry>
</row> </row>
<row> <row>
<entry>format</entry> <entry>format</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>the format of the result (sprintf)</entry> <entry>the format of the result (sprintf)</entry>
</row> </row>
<row> <row>
<entry>var</entry> <entry>var</entry>
<entry>numeric</entry> <entry>numeric</entry>
<entry>Yes</entry> <entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>equation variable value</entry> <entry>equation variable value</entry>
</row> </row>
<row> <row>
<entry>assign</entry> <entry>assign</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>template variable the output will be assigned to</entry> <entry>template variable the output will be assigned to</entry>
</row> </row>
<row> <row>
<entry>[var ...]</entry> <entry>[var ...]</entry>
<entry>numeric</entry> <entry>numeric</entry>
<entry>Yes</entry> <entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>equation variable value</entry> <entry>equation variable value</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
math allows the template designer to do math equations in the math allows the template designer to do math equations in the
template. Any numeric template variables may be used in the template. Any numeric template variables may be used in the
equations, and the result is printed in place of the tag. The equations, and the result is printed in place of the tag. The
variables used in the equation are passed as parameters, which can variables used in the equation are passed as parameters, which can
be template variables or static values. +, -, /, *, abs, ceil, cos, be template variables or static values. +, -, /, *, abs, ceil, cos,
exp, floor, log, log10, max, min, pi, pow, rand, round, sin, sqrt, exp, floor, log, log10, max, min, pi, pow, rand, round, sin, sqrt,
srans and tan are all valid operators. Check the PHP documentation srans and tan are all valid operators. Check the PHP documentation
for further information on these math functions. for further information on these math functions.
</para> </para>
<para> <para>
If you supply the special "assign" attribute, the output of the If you supply the special "assign" attribute, the output of the
math function will be assigned to this template variable instead of math function will be assigned to this template variable instead of
being output to the template. being output to the template.
</para> </para>
<note> <note>
<title>Technical Note</title> <title>Technical Note</title>
<para> <para>
math is an expensive function in performance due to its use of math is an expensive function in performance due to its use of
the php eval() function. Doing the math in PHP is much more the php eval() function. Doing the math in PHP is much more
efficient, so whenever possible do the math calculations in PHP efficient, so whenever possible do the math calculations in PHP
and assign the results to the template. Definately avoid and assign the results to the template. Definately avoid
repetitive math function calls, like within section loops. repetitive math function calls, like within section loops.
</para> </para>
</note> </note>
<example> <example>
<title>math</title> <title>math</title>
<programlisting> <programlisting>
{* $height=4, $width=5 *} <![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 *}
{math equation="x + y" x=4.4444 y=5.0000 format="%.2f"}
{* $row_height = 10, $row_width = 20, #col_div# = 2, assigned in template *} ]]>
</programlisting>
{math equation="height * width / division" <para>
height=$row_height The above example will output:
width=$row_width </para>
division=#col_div#} <screen>
<![CDATA[
OUTPUT: 9.44
]]>
100 </screen>
</example>
{* 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>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

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

View File

@@ -1,236 +1,269 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.textformat"> <sect1 id="language.function.textformat">
<title>textformat</title> <title>textformat</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
<colspec colname="type" align="center" /> <colspec colname="type" align="center" />
<colspec colname="required" align="center" /> <colspec colname="required" align="center" />
<colspec colname="default" align="center" /> <colspec colname="default" align="center" />
<colspec colname="desc" /> <colspec colname="desc" />
<thead> <thead>
<row> <row>
<entry>Attribute Name</entry> <entry>Attribute Name</entry>
<entry>Type</entry> <entry>Type</entry>
<entry>Required</entry> <entry>Required</entry>
<entry>Default</entry> <entry>Default</entry>
<entry>Description</entry> <entry>Description</entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry>style</entry> <entry>style</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>preset style</entry> <entry>preset style</entry>
</row> </row>
<row> <row>
<entry>indent</entry> <entry>indent</entry>
<entry>number</entry> <entry>number</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>0</emphasis></entry> <entry><emphasis>0</emphasis></entry>
<entry>The number of chars to indent every line</entry> <entry>The number of chars to indent every line</entry>
</row> </row>
<row> <row>
<entry>indent_first</entry> <entry>indent_first</entry>
<entry>number</entry> <entry>number</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>0</emphasis></entry> <entry><emphasis>0</emphasis></entry>
<entry>The number of chars to indent the first line</entry> <entry>The number of chars to indent the first line</entry>
</row> </row>
<row> <row>
<entry>indent_char</entry> <entry>indent_char</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>(single space)</emphasis></entry> <entry><emphasis>(single space)</emphasis></entry>
<entry>The character (or string of chars) to indent with</entry> <entry>The character (or string of chars) to indent with</entry>
</row> </row>
<row> <row>
<entry>wrap</entry> <entry>wrap</entry>
<entry>number</entry> <entry>number</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>80</emphasis></entry> <entry><emphasis>80</emphasis></entry>
<entry>How many characters to wrap each line to</entry> <entry>How many characters to wrap each line to</entry>
</row> </row>
<row> <row>
<entry>wrap_char</entry> <entry>wrap_char</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>\n</emphasis></entry> <entry><emphasis>\n</emphasis></entry>
<entry>The character (or string of chars) to break each <entry>The character (or string of chars) to break each
line with</entry> line with</entry>
</row> </row>
<row> <row>
<entry>wrap_cut</entry> <entry>wrap_cut</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>false</emphasis></entry> <entry><emphasis>false</emphasis></entry>
<entry>If true, wrap will break the line at the exact <entry>If true, wrap will break the line at the exact
character instead of at a word boundary</entry> character instead of at a word boundary</entry>
</row> </row>
<row> <row>
<entry>assign</entry> <entry>assign</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>the template variable the output will be assigned <entry>the template variable the output will be assigned
to</entry> to</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
textformat is a block function used to format text. It basically textformat is a block function used to format text. It basically
cleans up spaces and special characters, and formats paragraphs by cleans up spaces and special characters, and formats paragraphs by
wrapping at a boundary and indenting lines. wrapping at a boundary and indenting lines.
</para> </para>
<para> <para>
You can set the parameters explicitly, or use a preset style. You can set the parameters explicitly, or use a preset style.
Currently "email" is the only available style. Currently "email" is the only available style.
</para> </para>
<example> <example>
<title>textformat</title> <title>textformat</title>
<programlisting> <programlisting>
{textformat wrap=40} <![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 bar foo bar foo foo. bar foo bar foo
foo. bar foo bar foo foo. bar foo bar foo. bar foo bar foo foo. bar foo bar
foo foo. bar foo bar foo foo. bar foo foo foo. bar foo bar foo foo. bar foo
bar foo foo. bar foo bar foo 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. bar foo bar foo foo.
This is foo. bar foo bar foo foo.
This is foo. bar foo bar foo foo.
This is foo. bar foo bar foo foo.
This is foo. bar foo bar foo foo.
This is 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. </programlisting>
bar foo bar foo foo. <para>
bar foo bar foo foo. The above example will output:
bar foo bar foo foo. </para>
bar foo bar foo foo. <screen>
bar foo bar foo foo. <![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 bar foo bar foo foo. bar foo bar foo
foo. This is foo. This is foo. This foo. bar foo bar foo foo. bar foo
is 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 This is bar.
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} 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. {/textformat}
This is foo. ]]>
This is foo. </programlisting>
This is foo. <para>
This is foo. The above example will output:
This is foo. </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. 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.
{/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 This is bar.
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.
bar foo bar foo foo. bar foo bar {/textformat}
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"} ]]>
</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
This is foo. 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 bar foo foo. bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo
bar foo bar foo foo. foo.
bar foo bar foo foo.
bar foo bar foo foo.
bar foo bar foo foo.
bar foo bar foo foo.
{/textformat} ]]>
</screen>
OUTPUT: </example>
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> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables: