Add literal tags to html, general formatting

This commit is contained in:
pete_morgan
2006-09-27 08:47:37 +00:00
parent acc9df9694
commit 20b3333e4f
14 changed files with 165 additions and 156 deletions

View File

@@ -8,36 +8,41 @@
<link linkend="language.function.include">included</link> templates, <link linkend="language.function.include">included</link> templates,
<link linkend="api.assign">assigned</link> variables and <link linkend="api.assign">assigned</link> variables and
<link linkend="language.config.variables">config</link> <link linkend="language.config.variables">config</link>
file variables file variables for the current invocation of the template. A template file
for the current invocation of the template. A template named "debug.tpl" is named <literal>debug.tpl</literal> is included with the distribution of
included with the distribution of Smarty which controls the formatting of Smarty which controls the formatting of the console.
the console. Set </para>
<link linkend="variable.debugging">$debugging</link> to true in Smarty, and if needed set <para>
<link linkend="variable.debug.tpl">$debug_tpl</link> Set <link linkend="variable.debugging"><parameter>$debugging</parameter></link>
to the template resource path for debug.tpl (this is in to &true; in Smarty, and if needed set <link linkend="variable.debug.tpl">
<link linkend="constant.smarty.dir">SMARTY_DIR</link> by <parameter>$debug_tpl</parameter></link> to the template resource path to
default.) When you load the page, a javascript console window should pop up <literal>debug.tpl</literal> (this is in <link linkend="constant.smarty.dir">
<constant>SMARTY_DIR</constant></link> by default).
When you load the page, a Javascript console window will pop up
and give you the names of all the included templates and assigned variables and give you the names of all the included templates and assigned variables
for the current page. To see the available variables for a particular for the current page.</para>
templates, see the <link linkend="language.function.debug">{debug}</link> <para>To see the available variables for a particular
template function. To disable the debugging console, set template, see the <link linkend="language.function.debug">
<link linkend="variable.debugging">$debugging</link> to <varname>{debug}</varname></link> template function.
false. You can also temporarily turn on the debugging console by putting To disable the debugging console, set
SMARTY_DEBUG in the URL if you enable this option with <link <link linkend="variable.debugging"><parameter>$debugging</parameter></link> to
linkend="variable.debugging.ctrl">$debugging_ctrl</link>. &false;. You can also temporarily turn on the debugging console by putting
<literal>SMARTY_DEBUG</literal> in the URL if you enable this option with
<link linkend="variable.debugging.ctrl"><parameter>$debugging_ctrl</parameter>
</link>.
</para> </para>
<note> <note>
<title>Technical Note</title> <title>Technical Note</title>
<para> <para>
The debugging console does not work when you use the The debugging console does not work when you use the
<link linkend="api.fetch">fetch()</link> <link linkend="api.fetch"><varname>fetch()</varname></link>
API, only when using API, only when using <link linkend="api.display">
<link linkend="api.display">display()</link>. <varname>display()</varname></link>.
It is a set of javascript statements added It is a set of javascript statements added
to the very bottom of the generated template. If you do not like javascript, to the very bottom of the generated template. If you do not like javascript,
you can edit the debug.tpl template to format the output however you like. you can edit the <literal>debug.tpl</literal> template to format the output
Debug data is not cached and debug.tpl info is not included in the output of however you like. Debug data is not cached and <literal>debug.tpl</literal>
the debug console. info is not included in the output of the debug console.
</para> </para>
</note> </note>
<note> <note>
@@ -49,9 +54,10 @@
<para> <para>
See also See also
<link linkend="troubleshooting">troubleshooting</link>, <link linkend="troubleshooting">troubleshooting</link>,
<link linkend="variable.error.reporting">$error_reporting</link> <link linkend="variable.error.reporting">
<parameter>$error_reporting</parameter></link>
and and
<link linkend="api.trigger.error">trigger_error()</link>. <link linkend="api.trigger.error"><varname>trigger_error()</varname></link>.
</para> </para>
</chapter> </chapter>

View File

@@ -6,9 +6,9 @@
Template comments are surrounded by asterisks, and that is surrounded Template comments are surrounded by asterisks, and that is surrounded
by the by the
<link linkend="variable.left.delimiter">delimiter</link> <link linkend="variable.left.delimiter">delimiter</link>
tags like so: <emphasis>{* this is a comment *}</emphasis> tags like so: <literal>{* this is a comment *}</literal>
Smarty comments are NOT displayed in the final output of the template, Smarty comments are NOT displayed in the final output of the template,
unlike &lt;!-- HTML comments --&gt; unlike <literal>&lt;!-- HTML comments --&gt;</literal>
these are useful for making internal notes in the templates which no one will see ;-) these are useful for making internal notes in the templates which no one will see ;-)
</para> </para>
<example> <example>

View File

@@ -5,7 +5,7 @@
<para> <para>
<varname>{html_image}</varname> is a <varname>{html_image}</varname> is a
<link linkend="language.custom.functions">custom function</link> <link linkend="language.custom.functions">custom function</link>
that generates a HTML &lt;img&gt; tag. that generates an HTML <literal>&lt;img&gt;</literal> tag.
The <parameter>height</parameter> and <parameter>width</parameter> The <parameter>height</parameter> and <parameter>width</parameter>
are automatically calculated from the image file if they are not supplied. are automatically calculated from the image file if they are not supplied.
</para> </para>
@@ -92,8 +92,8 @@
<listitem><para> <listitem><para>
<parameter>href</parameter> is the href value to link the image to. <parameter>href</parameter> is the href value to link the image to.
If link is supplied, an &lt;a href="LINKVALUE"&gt;&lt;a&gt; tag is placed If link is supplied, an <literal>&lt;a href="LINKVALUE"&gt;&lt;a&gt;</literal>
around the image tag. tag is placed around the image tag.
</para> </listitem> </para> </listitem>
<listitem><para> <listitem><para>
@@ -104,7 +104,7 @@
<listitem><para> <listitem><para>
All parameters that are not in the list above are printed as All parameters that are not in the list above are printed as
name/value-pairs inside the created &lt;img&gt; tag. name/value-pairs inside the created <literal>&lt;img&gt;</literal> tag.
</para></listitem> </para></listitem>
</itemizedlist> </itemizedlist>

View File

@@ -5,7 +5,7 @@
<para> <para>
<varname>{html_options}</varname> is a <varname>{html_options}</varname> is a
<link linkend="language.custom.functions">custom function</link> <link linkend="language.custom.functions">custom function</link>
that creates a html &lt;select&gt;&lt;option&gt; group that creates the html <literal>&lt;select&gt;&lt;option&gt;</literal> group
with the assigned data. It takes care of which item(s) are selected by with the assigned data. It takes care of which item(s) are selected by
default as well. default as well.
</para> </para>
@@ -32,35 +32,35 @@
<entry>array</entry> <entry>array</entry>
<entry>Yes, unless using options attribute</entry> <entry>Yes, unless using options attribute</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>an array of values for dropdown</entry> <entry>An array of values for dropdown</entry>
</row> </row>
<row> <row>
<entry>output</entry> <entry>output</entry>
<entry>array</entry> <entry>array</entry>
<entry>Yes, unless using options attribute</entry> <entry>Yes, unless using options attribute</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>an array of output for dropdown</entry> <entry>An array of output for dropdown</entry>
</row> </row>
<row> <row>
<entry>selected</entry> <entry>selected</entry>
<entry>string/array</entry> <entry>string/array</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>empty</emphasis></entry> <entry><emphasis>empty</emphasis></entry>
<entry>the selected option element(s)</entry> <entry>The selected option element(s)</entry>
</row> </row>
<row> <row>
<entry>options</entry> <entry>options</entry>
<entry>associative array</entry> <entry>associative array</entry>
<entry>Yes, unless using values and output</entry> <entry>Yes, unless using values and output</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>an associative array of values and output</entry> <entry>An associative array of values and output</entry>
</row> </row>
<row> <row>
<entry>name</entry> <entry>name</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>empty</emphasis></entry> <entry><emphasis>empty</emphasis></entry>
<entry>name of select group</entry> <entry>Name of select group</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
@@ -76,18 +76,19 @@
<listitem><para> <listitem><para>
If the optional <parameter>name</parameter> attribute is given, the If the optional <parameter>name</parameter> attribute is given, the
&lt;select&gt;&lt;/select&gt; tags are created, <literal>&lt;select&gt;&lt;/select&gt;</literal> tags are created,
otherwise ONLY the &lt;option&gt;'s list are generated. otherwise ONLY the <literal>&lt;option&gt;</literal> list is generated.
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
If a given value is an array, it will treat it as an html &lt;optgroup&gt;, If a given value is an array, it will treat it as an html
and display the groups. Recursion is supported with &lt;optgroup&gt;. <literal>&lt;optgroup&gt;</literal>, and display the groups.
Recursion is supported with <literal>&lt;optgroup&gt;</literal>.
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
All parameters that are not in the list above are printed as All parameters that are not in the list above are printed as name/value-pairs
name/value-pairs inside the &lt;select&gt; tag. They are ignored if inside the <literal>&lt;select&gt;</literal> tag. They are ignored if
the optional <parameter>name</parameter> is not given. the optional <parameter>name</parameter> is not given.
</para></listitem> </para></listitem>
@@ -114,7 +115,7 @@ $smarty->assign('mySelect', 9904);
<para> <para>
The following template will generate a drop-down list. The following template will generate a drop-down list.
Note the presence of the <parameter>name</parameter> attribute Note the presence of the <parameter>name</parameter> attribute
which creates the &lt;select&gt; tags. which creates the <literal>&lt;select&gt;</literal> tags.
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -137,7 +138,8 @@ $smarty->assign('mySelect', 9904);
</example> </example>
<example> <example>
<title>Dropdown with seperate arrays for ouptut.</title> <title>Dropdown with seperate arrays for <varname>values</varname> and
<varname>ouptut</varname></title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -151,10 +153,10 @@ $smarty->assign('customer_id', 92);
]]> ]]>
</programlisting> </programlisting>
<para> <para>
The above arrays would be output with the following template. The above arrays would be output with the following template
Note the sneaky use of the php <ulink url="&url.php-manual;function.count"> (note the use of the php <ulink url="&url.php-manual;function.count">
<varname>count()</varname></ulink> function as a modifier <varname>count()</varname></ulink> function as a modifier
to set the select size. to set the select size).
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -194,7 +196,9 @@ $smarty->assign('contact',$db->getRow($sql));
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Where a template could be as follows. Note the use of the truncate modifier. Where a template could be as follows. Note the use of the
<link linkend="language.modifier.truncate"><varname>truncate</varname></link>
modifier.
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -218,8 +222,7 @@ $smarty->assign('fav', 7);
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para>With the template would be <para>The script above and the following template
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -228,7 +231,7 @@ $smarty->assign('fav', 7);
</programlisting> </programlisting>
<para> <para>
Output of the above example would be: would output:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[

View File

@@ -5,8 +5,8 @@
<para> <para>
<varname>{html_radios}</varname> is a <varname>{html_radios}</varname> is a
<link linkend="language.custom.functions">custom function</link> <link linkend="language.custom.functions">custom function</link>
that creates html radio button group. that creates a HTML radio button group.
It takes care of which item is selected by default as well. It also takes care of which item is selected by default as well.
</para> </para>
@@ -32,49 +32,49 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>radio</emphasis></entry> <entry><emphasis>radio</emphasis></entry>
<entry>name of radio list</entry> <entry>Name of radio list</entry>
</row> </row>
<row> <row>
<entry>values</entry> <entry>values</entry>
<entry>array</entry> <entry>array</entry>
<entry>Yes, unless using options attribute</entry> <entry>Yes, unless using options attribute</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>an array of values for radio buttons</entry> <entry>An array of values for radio buttons</entry>
</row> </row>
<row> <row>
<entry>output</entry> <entry>output</entry>
<entry>array</entry> <entry>array</entry>
<entry>Yes, unless using options attribute</entry> <entry>Yes, unless using options attribute</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>an array of output for radio buttons</entry> <entry>An array of output for radio buttons</entry>
</row> </row>
<row> <row>
<entry>selected</entry> <entry>selected</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>empty</emphasis></entry> <entry><emphasis>empty</emphasis></entry>
<entry>the selected radio element</entry> <entry>The selected radio element</entry>
</row> </row>
<row> <row>
<entry>options</entry> <entry>options</entry>
<entry>associative array</entry> <entry>associative array</entry>
<entry>Yes, unless using values and output</entry> <entry>Yes, unless using values and output</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>an associative array of values and output</entry> <entry>An associative array of values and output</entry>
</row> </row>
<row> <row>
<entry>separator</entry> <entry>separator</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>empty</emphasis></entry> <entry><emphasis>empty</emphasis></entry>
<entry>string of text to separate each radio item</entry> <entry>String of text to separate each radio item</entry>
</row> </row>
<row> <row>
<entry>assign</entry> <entry>assign</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>empty</emphasis></entry> <entry><emphasis>empty</emphasis></entry>
<entry>assign radio tags to an array instead of output</entry> <entry>Assign radio tags to an array instead of output</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
@@ -92,8 +92,9 @@
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
All parameters that are not in the list above are printed as All parameters that are not in the list above are output as
name/value-pairs inside each of the created &lt;input&gt;-tags. name/value-pairs inside each of the created
<literal>&lt;input&gt;</literal>-tags.
</para></listitem> </para></listitem>
</itemizedlist> </itemizedlist>
<example> <example>

View File

@@ -8,7 +8,8 @@
that creates date dropdowns. that creates date dropdowns.
It can display any or all of year, month, and day. It can display any or all of year, month, and day.
All parameters that are not in the list below are printed as All parameters that are not in the list below are printed as
name/value-pairs inside the &lt;select&gt; tags of day, month and year. name/value-pairs inside the <literal>&lt;select&gt;</literal> tags
of day, month and year.
</para> </para>
<informaltable frame="all"> <informaltable frame="all">
@@ -33,21 +34,21 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>Date_</entry> <entry>Date_</entry>
<entry>what to prefix the var name with</entry> <entry>What to prefix the var name with</entry>
</row> </row>
<row> <row>
<entry>time</entry> <entry>time</entry>
<entry>timestamp/YYYY-MM-DD</entry> <entry>timestamp/ YYYY-MM-DD</entry>
<entry>No</entry> <entry>No</entry>
<entry>current time in unix timestamp or YYYY-MM-DD format</entry> <entry>current time in unix timestamp or YYYY-MM-DD format</entry>
<entry>what date/time to use</entry> <entry>What date/time to use</entry>
</row> </row>
<row> <row>
<entry>start_year</entry> <entry>start_year</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>current year</entry> <entry>current year</entry>
<entry>the first year in the dropdown, either <entry>The first year in the dropdown, either
year number, or relative to current year (+/- N)</entry> year number, or relative to current year (+/- N)</entry>
</row> </row>
<row> <row>
@@ -55,7 +56,7 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>same as start_year</entry> <entry>same as start_year</entry>
<entry>the last year in the dropdown, either <entry>The last year in the dropdown, either
year number, or relative to current year (+/- N)</entry> year number, or relative to current year (+/- N)</entry>
</row> </row>
<row> <row>
@@ -63,56 +64,56 @@
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry>&true;</entry> <entry>&true;</entry>
<entry>whether to display days or not</entry> <entry>Whether to display days or not</entry>
</row> </row>
<row> <row>
<entry>display_months</entry> <entry>display_months</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry>&true;</entry> <entry>&true;</entry>
<entry>whether to display months or not</entry> <entry>Whether to display months or not</entry>
</row> </row>
<row> <row>
<entry>display_years</entry> <entry>display_years</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry>&true;</entry> <entry>&true;</entry>
<entry>whether to display years or not</entry> <entry>Whether to display years or not</entry>
</row> </row>
<row> <row>
<entry>month_format</entry> <entry>month_format</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>%B</entry> <entry>%B</entry>
<entry>what format the month should be in (strftime)</entry> <entry>What format the month should be in (strftime)</entry>
</row> </row>
<row> <row>
<entry>day_format</entry> <entry>day_format</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>%02d</entry> <entry>%02d</entry>
<entry>what format the day output should be in (sprintf)</entry> <entry>What format the day output should be in (sprintf)</entry>
</row> </row>
<row> <row>
<entry>day_value_format</entry> <entry>day_value_format</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>%d</entry> <entry>%d</entry>
<entry>what format the day value should be in (sprintf)</entry> <entry>What format the day value should be in (sprintf)</entry>
</row> </row>
<row> <row>
<entry>year_as_text</entry> <entry>year_as_text</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry>&false;</entry> <entry>&false;</entry>
<entry>whether or not to display the year as text</entry> <entry>Whether or not to display the year as text</entry>
</row> </row>
<row> <row>
<entry>reverse_years</entry> <entry>reverse_years</entry>
<entry>boolean</entry> <entry>boolean</entry>
<entry>No</entry> <entry>No</entry>
<entry>&false;</entry> <entry>&false;</entry>
<entry>display years in reverse order</entry> <entry>Display years in reverse order</entry>
</row> </row>
<row> <row>
<entry>field_array</entry> <entry>field_array</entry>
@@ -120,7 +121,7 @@
<entry>No</entry> <entry>No</entry>
<entry>null</entry> <entry>null</entry>
<entry> <entry>
if a name is given, the select boxes will be drawn If a name is given, the select boxes will be drawn
such that the results will be returned to PHP in the such that the results will be returned to PHP in the
form of name[Day], name[Year], name[Month]. form of name[Day], name[Year], name[Month].
</entry> </entry>
@@ -130,70 +131,70 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>null</entry> <entry>null</entry>
<entry>adds size attribute to select tag if given</entry> <entry>Adds size attribute to select tag if given</entry>
</row> </row>
<row> <row>
<entry>month_size</entry> <entry>month_size</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>null</entry> <entry>null</entry>
<entry>adds size attribute to select tag if given</entry> <entry>Adds size attribute to select tag if given</entry>
</row> </row>
<row> <row>
<entry>year_size</entry> <entry>year_size</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>null</entry> <entry>null</entry>
<entry>adds size attribute to select tag if given</entry> <entry>Adds size attribute to select tag if given</entry>
</row> </row>
<row> <row>
<entry>all_extra</entry> <entry>all_extra</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>null</entry> <entry>null</entry>
<entry>adds extra attributes to all select/input tags if given</entry> <entry>Adds extra attributes to all select/input tags if given</entry>
</row> </row>
<row> <row>
<entry>day_extra</entry> <entry>day_extra</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>null</entry> <entry>null</entry>
<entry>adds extra attributes to select/input tags if given</entry> <entry>Adds extra attributes to select/input tags if given</entry>
</row> </row>
<row> <row>
<entry>month_extra</entry> <entry>month_extra</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>null</entry> <entry>null</entry>
<entry>adds extra attributes to select/input tags if given</entry> <entry>Adds extra attributes to select/input tags if given</entry>
</row> </row>
<row> <row>
<entry>year_extra</entry> <entry>year_extra</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>null</entry> <entry>null</entry>
<entry>adds extra attributes to select/input tags if given</entry> <entry>Adds extra attributes to select/input tags if given</entry>
</row> </row>
<row> <row>
<entry>field_order</entry> <entry>field_order</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>MDY</entry> <entry>MDY</entry>
<entry>the order in which to display the fields</entry> <entry>The order in which to display the fields</entry>
</row> </row>
<row> <row>
<entry>field_separator</entry> <entry>field_separator</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>\n</entry> <entry>\n</entry>
<entry>string printed between different fields</entry> <entry>String printed between different fields</entry>
</row> </row>
<row> <row>
<entry>month_value_format</entry> <entry>month_value_format</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>%m</entry> <entry>%m</entry>
<entry>strftime format of the month values, default is <entry>strftime() format of the month values, default is
%m for month numbers.</entry> %m for month numbers.</entry>
</row> </row>
<row> <row>
@@ -233,9 +234,9 @@
<note> <note>
<para> <para>
There's an useful php function on the There is an useful php function on the
<link linkend="tips.dates">date tips page</link> for converting <link linkend="tips.dates">date tips page</link> for converting
<varname>{html_select_date}</varname> values to a timestamp. <varname>{html_select_date}</varname> form values to a timestamp.
</para> </para>
</note> </note>
@@ -277,7 +278,7 @@
<option value="31">31</option> <option value="31">31</option>
</select> </select>
<select name="Date_Year"> <select name="Date_Year">
<option value="2001" selected="selected">2001</option> <option value="2006" selected="selected">2006</option>
</select> </select>
]]> ]]>
</screen> </screen>
@@ -288,8 +289,8 @@
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{* start and end year can be relative to current year *} {* start and end year can be relative to current year *}
{html_select_date prefix="StartDate" time=$time start_year="-5" {html_select_date prefix='StartDate' time=$time start_year='-5'
end_year="+1" display_days=false} end_year='+1' display_days=false}
]]> ]]>
</programlisting> </programlisting>
<para> <para>

View File

@@ -10,8 +10,8 @@
</para> </para>
<para> <para>
The <parameter>time</parameter> attribute can have different formats. The <parameter>time</parameter> attribute can have different formats.
It can be a unique timestamp, a string of the format YYYYMMDDHHMMSS It can be a unique timestamp, a string of the format
or a string that is parseable by php's <literal>YYYYMMDDHHMMSS</literal> or a string that is parseable by PHP's
<ulink url="&url.php-manual;strtotime"><varname>strtotime()</varname></ulink>. <ulink url="&url.php-manual;strtotime"><varname>strtotime()</varname></ulink>.
</para> </para>

View File

@@ -5,7 +5,7 @@
<para> <para>
<varname>{html_table}</varname> is a <varname>{html_table}</varname> is a
<link linkend="language.custom.functions">custom function</link> <link linkend="language.custom.functions">custom function</link>
that dumps an array of data into an HTML table. that dumps an array of data into an HTML <literal>&lt;table&gt;</literal>.
</para> </para>
<informaltable frame="all"> <informaltable frame="all">
@@ -30,7 +30,7 @@
<entry>array</entry> <entry>array</entry>
<entry>Yes</entry> <entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>array of data to loop through</entry> <entry>Array of data to loop through</entry>
</row> </row>
<row> <row>
<entry>cols</entry> <entry>cols</entry>
@@ -38,7 +38,7 @@
<entry>No</entry> <entry>No</entry>
<entry><emphasis>3</emphasis></entry> <entry><emphasis>3</emphasis></entry>
<entry> <entry>
number of columns in the table or a comma-separated list of column heading Number of columns in the table or a comma-separated list of column heading
names or an array of column heading names.if the cols-attribute is empty, names or an array of column heading names.if the cols-attribute is empty,
but rows are given, then the number of cols is computed by the number but rows are given, then the number of cols is computed by the number
of rows and the number of elements to display to be just enough cols to of rows and the number of elements to display to be just enough cols to
@@ -53,7 +53,7 @@
<entry>No</entry> <entry>No</entry>
<entry><emphasis>empty</emphasis></entry> <entry><emphasis>empty</emphasis></entry>
<entry> <entry>
number of rows in the table. if the rows-attribute is empty, but Number of rows in the table. if the rows-attribute is empty, but
cols are given, then the number of rows is computed by the number of cols are given, then the number of rows is computed by the number of
cols and the number of elements to display to be just enough rows to cols and the number of elements to display to be just enough rows to
display all elements. display all elements.
@@ -65,7 +65,7 @@
<entry>No</entry> <entry>No</entry>
<entry><emphasis>cols</emphasis></entry> <entry><emphasis>cols</emphasis></entry>
<entry> <entry>
direction of consecutive elements in the loop-array to be Direction of consecutive elements in the loop-array to be
rendered. <emphasis>cols</emphasis> means elements are displayed rendered. <emphasis>cols</emphasis> means elements are displayed
col-by-col. <emphasis>rows</emphasis> means elements are displayed col-by-col. <emphasis>rows</emphasis> means elements are displayed
row-by-row. row-by-row.
@@ -76,44 +76,46 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>empty</emphasis></entry> <entry><emphasis>empty</emphasis></entry>
<entry> <entry>Text to be used for the <literal>&lt;caption&gt;</literal>
text to be used for the caption element of the table. element of the table</entry>
</entry>
</row> </row>
<row> <row>
<entry>table_attr</entry> <entry>table_attr</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>border="1"</emphasis></entry> <entry><emphasis>border="1"</emphasis></entry>
<entry>attributes for table tag</entry> <entry>Attributes for <literal>&lt;table&gt;</literal> tag</entry>
</row> </row>
<row> <row>
<entry>th_attr</entry> <entry>th_attr</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>empty</emphasis></entry> <entry><emphasis>empty</emphasis></entry>
<entry>attributes for th tag (arrays are cycled)</entry> <entry>Attributes for <literal>&lt;th&gt;</literal> tag
(arrays are cycled)</entry>
</row> </row>
<row> <row>
<entry>tr_attr</entry> <entry>tr_attr</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>empty</emphasis></entry> <entry><emphasis>empty</emphasis></entry>
<entry>attributes for tr tag (arrays are cycled)</entry> <entry>attributes for <literal>&lt;tr&gt;</literal> tag
(arrays are cycled)</entry>
</row> </row>
<row> <row>
<entry>td_attr</entry> <entry>td_attr</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>empty</emphasis></entry> <entry><emphasis>empty</emphasis></entry>
<entry>attributes for td tag (arrays are cycled)</entry> <entry>Attributes for <literal>&lt;td&gt;</literal> tag
(arrays are cycled)</entry>
</row> </row>
<row> <row>
<entry>trailpad</entry> <entry>trailpad</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>&amp;nbsp;</emphasis></entry> <entry><emphasis>&amp;nbsp;</emphasis></entry>
<entry>value to pad the trailing cells on last row with (if any)</entry> <entry>Value to pad the trailing cells on last row with (if any)</entry>
</row> </row>
<row> <row>
<entry>hdir</entry> <entry>hdir</entry>
@@ -121,7 +123,7 @@
<entry>No</entry> <entry>No</entry>
<entry><emphasis>right</emphasis></entry> <entry><emphasis>right</emphasis></entry>
<entry> <entry>
direction of each row to be rendered. possible values: Direction of each row to be rendered. possible values:
<emphasis>right</emphasis> (left-to-right), and <emphasis>right</emphasis> (left-to-right), and
<emphasis>left</emphasis> (right-to-left) <emphasis>left</emphasis> (right-to-left)
</entry> </entry>
@@ -132,7 +134,7 @@
<entry>No</entry> <entry>No</entry>
<entry><emphasis>down</emphasis></entry> <entry><emphasis>down</emphasis></entry>
<entry> <entry>
direction of each column to be rendered. possible values: Direction of each column to be rendered. possible values:
<emphasis>down</emphasis> (top-to-bottom), <emphasis>up</emphasis> <emphasis>down</emphasis> (top-to-bottom), <emphasis>up</emphasis>
(bottom-to-top) (bottom-to-top)
</entry> </entry>
@@ -150,7 +152,8 @@
<listitem><para> <listitem><para>
The <parameter>table_attr</parameter>, <parameter>tr_attr</parameter> The <parameter>table_attr</parameter>, <parameter>tr_attr</parameter>
and <parameter>td_attr</parameter> values determine the attributes given and <parameter>td_attr</parameter> values determine the attributes given
to the &lt;table&gt;, &lt;tr&gt; and &lt;td&gt; tags. to the <literal>&lt;table&gt;</literal>, <literal>&lt;tr&gt;</literal>
and <literal>&lt;td&gt;</literal> tags.
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
@@ -169,8 +172,8 @@
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
$smarty->assign('data',array(1,2,3,4,5,6,7,8,9)); $smarty->assign( 'data', array(1,2,3,4,5,6,7,8,9) );
$smarty->assign('tr',array('bgcolor="#eeeeee"','bgcolor="#dddddd"')); $smarty->assign( 'tr', array('bgcolor="#eeeeee"','bgcolor="#dddddd"') );
$smarty->display('index.tpl'); $smarty->display('index.tpl');
?> ?>
]]> ]]>

View File

@@ -3,9 +3,9 @@
<sect1 id="language.function.mailto"> <sect1 id="language.function.mailto">
<title>{mailto}</title> <title>{mailto}</title>
<para> <para>
<varname>{mailto}</varname> automates the creation of mailto: links <varname>{mailto}</varname> automates the creation of a <literal>mailto:</literal>
and optionally encodes them. Encoding e-mails makes it more difficult for anchor links and optionally encodes them. Encoding emails makes it more
web spiders to lift e-mail addresses off of a site. difficult for web spiders to lift email addresses off of a site.
<note> <note>
<title>Technical Note</title> <title>Technical Note</title>
<para> <para>
@@ -117,7 +117,7 @@
{mailto address="me@example.com" encode="javascript"} {mailto address="me@example.com" encode="javascript"}
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
eval(unescape('%64%6f% ... snipped ...%61%3e%27%29%3b')) eval(unescape('%64%6f% ... snipped ...%61%3e%27%29%3b'))
</script> </script>
{mailto address="me@example.com" encode="hex"} {mailto address="me@example.com" encode="hex"}
@@ -134,9 +134,9 @@
{mailto address="me@example.com" encode="javascript_charcode"} {mailto address="me@example.com" encode="javascript_charcode"}
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
<!-- <!--
{document.write(String.fromCharCode(60,97, ... snipped ....60,47,97,62))} {document.write(String.fromCharCode(60,97, ... snipped ....60,47,97,62))}
//--> //-->
</script> </script>
]]> ]]>
</programlisting> </programlisting>
@@ -145,8 +145,8 @@
See also See also
<link linkend="language.modifier.escape"><varname>escape</varname></link>, <link linkend="language.modifier.escape"><varname>escape</varname></link>,
<link linkend="language.function.textformat"><varname>{textformat}</varname></link> <link linkend="language.function.textformat"><varname>{textformat}</varname></link>
and the and
<link linkend="tips.obfuscating.email">obfuscating email addresses</link> page. <link linkend="tips.obfuscating.email">obfuscating email addresses</link>.
</para> </para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -12,8 +12,8 @@
<itemizedlist> <itemizedlist>
<listitem><para> <listitem><para>
<varname>{popup_init}</varname> must be called <varname>{popup_init}</varname> must be called <emphasis>only once</emphasis>,
<emphasis>only once</emphasis>, preferably within the &lt;head&gt; tag preferably within the <literal>&lt;head&gt;</literal> tag
within any page you plan on using the <link linkend="language.function.popup"> within any page you plan on using the <link linkend="language.function.popup">
<varname>{popup}</varname></link> function. <varname>{popup}</varname></link> function.
</para></listitem> </para></listitem>

View File

@@ -35,50 +35,49 @@
<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>
@@ -86,8 +85,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>
@@ -269,9 +267,9 @@
</example> </example>
<para> <para>
See also See also
<link linkend="language.function.strip"><varname>{strip}</varname></link> <link linkend="language.function.strip"><varname>{strip}</varname></link>
and and
<link linkend="language.modifier.wordwrap"><varname>wordwrap</varname></link>. <link linkend="language.modifier.wordwrap"><varname>wordwrap</varname></link>.
</para> </para>
</sect1> </sect1>

View File

@@ -95,7 +95,7 @@ rowBgColor = "#cccccc"
<varname>{config_load}</varname></link>. <varname>{config_load}</varname></link>.
</para> </para>
<para> <para>
See also <link linkend="language.syntax.variables">Variables</link> and See also <link linkend="language.syntax.variables">variables</link> and
<link linkend="language.variables.smarty">$smarty reserved <link linkend="language.variables.smarty">$smarty reserved
variables</link> variables</link>
</para> </para>

View File

@@ -74,19 +74,18 @@
<link linkend="language.modifier.date.format"><varname>date_format</varname> <link linkend="language.modifier.date.format"><varname>date_format</varname>
</link> modifier for display. Note that </link> modifier for display. Note that
<ulink url="&url.php-manual;function.time"><varname>time()</varname></ulink> <ulink url="&url.php-manual;function.time"><varname>time()</varname></ulink>
is called each invocation; eg a script that takes three seconds to execute is called on each invocation; eg a script that takes three seconds to execute
with a call to <parameter>$smarty.now</parameter> at start and end with a call to <parameter>$smarty.now</parameter> at start and end
will show the three second difference. will show the three second difference.
</para> <informalexample>
<example>
<title>Using {$smarty.now}</title>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{* use the date_format modifier to show current date and time *} {* use the date_format modifier to show current date and time *}
{$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'} {$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'}
]]> ]]>
</programlisting> </programlisting>
</example> </informalexample>
</para>
</sect2> </sect2>
<sect2 id="language.variables.smarty.const"> <sect2 id="language.variables.smarty.const">
@@ -94,9 +93,8 @@
<para> <para>
You can access PHP constant values directly. See also <link You can access PHP constant values directly. See also <link
linkend="smarty.constants">smarty constants</link>. linkend="smarty.constants">smarty constants</link>.
</para> </para>
<example> <informalexample>
<title>Using {$smarty.const} to access a constant</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -105,13 +103,15 @@ define('MY_CONST_VAL','CHERRIES');
?> ?>
]]> ]]>
</programlisting> </programlisting>
</informalexample>
<para>Output the constant in a template with</para> <para>Output the constant in a template with</para>
<informalexample>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{$smarty.const.MY_CONST_VAL} {$smarty.const.MY_CONST_VAL}
]]> ]]>
</programlisting> </programlisting>
</example> </informalexample>
</sect2> </sect2>
<sect2 id="language.variables.smarty.capture"> <sect2 id="language.variables.smarty.capture">
@@ -170,7 +170,7 @@ define('MY_CONST_VAL','CHERRIES');
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
<b>Main page if container.tpl</b> <b>Main page is container.tpl</b>
banner.tpl banner.tpl
]]> ]]>
</programlisting> </programlisting>

View File

@@ -330,15 +330,12 @@ $smarty = new Smarty();
<literal>index.php</literal> onto the end of your <literal>index.php</literal> onto the end of your
<literal>DirectoryIndex</literal> setting (separate <literal>DirectoryIndex</literal> setting (separate
each entry with a space) as in the following <filename>httpd.conf</filename> example. each entry with a space) as in the following <filename>httpd.conf</filename> example.
</para> <informalexample>
<programlisting>
<example> <![CDATA[DirectoryIndex index.htm index.html index.cgi index.php]]>
<title>http.conf</title> </programlisting>
<programlisting> </informalexample>
<![CDATA[DirectoryIndex index.htm index.html index.cgi index.php]]> </para>
</programlisting>
</example>
</note> </note>
<para> <para>