mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
updates by Peter Morgan:
more cross-linking better distinction between {assign} and assign() and {fetch} and fetch()
This commit is contained in:
@@ -45,7 +45,7 @@
|
|||||||
If a variable is used frequently throughout your templates, applying
|
If a variable is used frequently throughout your templates, applying
|
||||||
the default modifier every time it is mentioned can get a bit ugly. You
|
the default modifier every time it is mentioned can get a bit ugly. You
|
||||||
can remedy this by assigning the variable its default value with the
|
can remedy this by assigning the variable its default value with the
|
||||||
<link linkend="language.function.assign">assign</link> function.
|
<link linkend="language.function.assign">{assign}</link> function.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>Assigning a template variable its default value</title>
|
<title>Assigning a template variable its default value</title>
|
||||||
@@ -118,7 +118,8 @@ footer.tpl
|
|||||||
archive example, we are using a variable from the archives_page.conf
|
archive example, we are using a variable from the archives_page.conf
|
||||||
file instead of a hard coded variable. Also notice that "BC News" is
|
file instead of a hard coded variable. Also notice that "BC News" is
|
||||||
printed if the $title variable is not set, using the
|
printed if the $title variable is not set, using the
|
||||||
<emphasis>default</emphasis> variable modifier.
|
<link linkend="language.modifier.default">default</link>
|
||||||
|
variable modifier.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="tips.dates">
|
<sect1 id="tips.dates">
|
||||||
@@ -208,7 +209,16 @@ function makeTimeStamp($year="", $month="", $day="")
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="language.function.html.select.date">{html_select_date}</link>,
|
||||||
|
<link linkend="language.function.html.select.time">{html_select_time}</link>,
|
||||||
|
<link linkend="language.modifier.date.format">date_format</link>
|
||||||
|
and <link linkend="language.variables.smarty.now">$smarty.now</link>,
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<sect1 id="tips.wap">
|
<sect1 id="tips.wap">
|
||||||
<title>WAP/WML</title>
|
<title>WAP/WML</title>
|
||||||
<para>
|
<para>
|
||||||
|
@@ -47,12 +47,21 @@ Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75
|
|||||||
When you encounter a PHP parsing error, the error line number will
|
When you encounter a PHP parsing error, the error line number will
|
||||||
correspond to the compiled PHP script, not the template itself. Usually
|
correspond to the compiled PHP script, not the template itself. Usually
|
||||||
you can look at the template and spot the syntax error. Here are some
|
you can look at the template and spot the syntax error. Here are some
|
||||||
common things to look for: missing close tags for {if}{/if} or
|
common things to look for: missing close tags for
|
||||||
{section}{/section}, or syntax of logic within an {if} tag. If you
|
<link linkend="language.function.if">{if}{/if}</link> or
|
||||||
|
<link linkend="language.function.if">{section}{/section}</link>,
|
||||||
|
or syntax of logic within an {if} tag. If you
|
||||||
can't find the error, you might have to open the compiled PHP file and
|
can't find the error, you might have to open the compiled PHP file and
|
||||||
go to the line number to figure out where the corresponding error is in
|
go to the line number to figure out where the corresponding error is in
|
||||||
the template.
|
the template.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="chapter.debugging.console">debugging</link>,
|
||||||
|
<link linkend="variable.error.reporting">$error_reporting</link>
|
||||||
|
and
|
||||||
|
<link linkend="api.trigger.error">trigger_error()</link>.
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
</chapter>
|
</chapter>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -46,6 +46,13 @@
|
|||||||
fractions thereof.
|
fractions thereof.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="troubleshooting">troubleshooting</link>,
|
||||||
|
<link linkend="variable.error.reporting">$error_reporting</link>
|
||||||
|
and
|
||||||
|
<link linkend="api.trigger.error">trigger_error()</link>.
|
||||||
|
</para>
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -87,7 +87,9 @@
|
|||||||
</example>
|
</example>
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
See also <link linkend="language.function.eval">{eval}</link>
|
See also <link linkend="language.function.eval">{eval}</link>,
|
||||||
|
<link linkend="language.function.fetch">{fetch}</link>,
|
||||||
|
<link linkend="api.fetch">fetch()</link>
|
||||||
and <link linkend="language.function.assign">{assign}</link>.
|
and <link linkend="language.function.assign">{assign}</link>.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
@@ -91,7 +91,8 @@
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
Config files may also contain sections. You can load variables from
|
<link linkend="config.files">Config Files</link>
|
||||||
|
may also contain sections. You can load variables from
|
||||||
within a section with the added attribute
|
within a section with the added attribute
|
||||||
<emphasis>section</emphasis>.
|
<emphasis>section</emphasis>.
|
||||||
</para>
|
</para>
|
||||||
@@ -126,8 +127,11 @@
|
|||||||
</example>
|
</example>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
See also <link linkend="config.files">Config Files</link> and
|
See also <link linkend="config.files">Config Files</link>,
|
||||||
<link linkend="language.config.variables">Config variables</link>.
|
<link linkend="language.config.variables">Config variables</link>,
|
||||||
|
<link linkend="api.get.config.vars">get_config_vars()</link>
|
||||||
|
and
|
||||||
|
<link linkend="api.config.load">config_load()</link>.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
@@ -53,23 +53,24 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<para>
|
||||||
<emphasis>foreach</emphasis> loops are an alternative to
|
<emphasis>{foreach}</emphasis> loops are an alternative to
|
||||||
<link
|
<link
|
||||||
linkend="language.function.section"><emphasis>section</emphasis></link>
|
linkend="language.function.section"><emphasis>{section}</emphasis></link>
|
||||||
loops. <emphasis>foreach</emphasis> is used to loop over a single
|
loops. <emphasis>foreach</emphasis> is used to loop over a single
|
||||||
associative array. The syntax for
|
associative array. The syntax for
|
||||||
<emphasis>foreach</emphasis> is much easier than
|
<emphasis>{foreach}</emphasis> is much easier than
|
||||||
<emphasis>section</emphasis>, but as a tradeoff it can only be used
|
<emphasis>{section}</emphasis>, but as a tradeoff it
|
||||||
for a single array. <emphasis>foreach</emphasis> tags must be
|
<emphasis role="bold">can only be used
|
||||||
paired with <emphasis>/foreach</emphasis> tags. Required parameters
|
for a single array</emphasis>. <emphasis>{foreach}</emphasis> tags must be
|
||||||
|
paired with <emphasis>{/foreach}</emphasis> tags. Required parameters
|
||||||
are <emphasis>from</emphasis> and <emphasis>item</emphasis>. The
|
are <emphasis>from</emphasis> and <emphasis>item</emphasis>. The
|
||||||
name of the foreach loop can be anything you like, made up of
|
name of the {foreach} loop can be anything you like, made up of
|
||||||
letters, numbers and underscores. <emphasis>foreach</emphasis>
|
letters, numbers and underscores. <emphasis>{foreach}</emphasis>
|
||||||
loops can be nested, and the nested foreach names must be unique
|
loops can be nested, and the nested {foreach} names must be unique
|
||||||
from each other. The <emphasis>from</emphasis> variable (usually an
|
from each other. The <emphasis>from</emphasis> variable (usually an
|
||||||
array of values) determines the number of times
|
array of values) determines the number of times
|
||||||
<emphasis>foreach</emphasis> will loop.
|
<emphasis>{foreach}</emphasis> will loop.
|
||||||
<emphasis>foreachelse</emphasis> is executed when there are no
|
<emphasis>{foreachelse}</emphasis> is executed when there are no
|
||||||
values in the <emphasis>from</emphasis> variable.
|
values in the <emphasis>from</emphasis> variable.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
@@ -132,7 +133,9 @@
|
|||||||
|
|
||||||
<para>
|
<para>
|
||||||
Foreach-loops also have their own variables that handle foreach properties.
|
Foreach-loops also have their own variables that handle foreach properties.
|
||||||
These are indicated like so: {$smarty.foreach.foreachname.varname} with
|
These are indicated like so:
|
||||||
|
<link linkend="language.variables.smarty.loops">{$smarty.foreach.foreachname.varname}</link>
|
||||||
|
with
|
||||||
foreachname being the name specified as the <emphasis>name</emphasis>
|
foreachname being the name specified as the <emphasis>name</emphasis>
|
||||||
attribute of foreach
|
attribute of foreach
|
||||||
</para>
|
</para>
|
||||||
|
@@ -45,15 +45,15 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<para>
|
||||||
Include tags are used for including other templates in the current
|
{include} tags are used for including other templates in the current
|
||||||
template. Any variables available in the current template are also
|
template. Any variables available in the current template are also
|
||||||
available within the included template. The include tag must have
|
available within the included template. The {include} tag must have
|
||||||
the attribute "file", which contains the template resource path.
|
the attribute "file", which contains the template resource path.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
You can optionally pass the <emphasis>assign</emphasis> attribute,
|
You can optionally pass the <emphasis>assign</emphasis> attribute,
|
||||||
which will specify a template variable name that the output of
|
which will specify a template variable name that the output of
|
||||||
<emphasis>include</emphasis> will be assigned to instead of
|
{include} will be assigned to instead of
|
||||||
displayed.
|
displayed.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
@@ -90,7 +90,8 @@
|
|||||||
<para>
|
<para>
|
||||||
Use the syntax for <link
|
Use the syntax for <link
|
||||||
linkend="template.resources">template resources</link> to
|
linkend="template.resources">template resources</link> to
|
||||||
include files outside of the <link linkend="variable.template.dir">$template_dir</link> directory.
|
include files outside of the <link linkend="variable.template.dir">$template_dir</link>
|
||||||
|
directory.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>function include template resource examples</title>
|
<title>function include template resource examples</title>
|
||||||
@@ -138,3 +139,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
|||||||
vim: et tw=78 syn=sgml
|
vim: et tw=78 syn=sgml
|
||||||
vi: ts=1 sw=1
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<sect1 id="language.function.literal">
|
<sect1 id="language.function.literal">
|
||||||
<title>literal</title>
|
<title>literal</title>
|
||||||
<para>
|
<para>
|
||||||
Literal tags allow a block of data to be taken literally. This is typically
|
{literal} tags allow a block of data to be taken literally. This is typically
|
||||||
used around javascript or stylesheet blocks where curly braces would
|
used around javascript or stylesheet blocks where curly braces would
|
||||||
interfere with the template delimiter syntax. Anything within
|
interfere with the template delimiter syntax. Anything within
|
||||||
{literal}{/literal} tags is not interpreted, but displayed as-is. If you
|
{literal}{/literal} tags is not interpreted, but displayed as-is. If you
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
<sect1 id="language.function.php">
|
<sect1 id="language.function.php">
|
||||||
<title>php</title>
|
<title>php</title>
|
||||||
<para>
|
<para>
|
||||||
php tags allow php to be embedded directly into the template. They
|
{php} tags allow php to be embedded directly into the template. They
|
||||||
will not be escaped, regardless of the <link
|
will not be escaped, regardless of the <link
|
||||||
linkend="variable.php.handling">$php_handling</link> setting. This
|
linkend="variable.php.handling">$php_handling</link> setting. This
|
||||||
is for advanced users only, not normally needed.
|
is for advanced users only, not normally needed.
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
See also
|
See also
|
||||||
|
<link linkend="variable.php.handling">$php_handling</link>,
|
||||||
<link linkend="language.function.include.php">{include_php}</link>,
|
<link linkend="language.function.include.php">{include_php}</link>,
|
||||||
<link linkend="language.function.include">{include}</link> and
|
<link linkend="language.function.include">{include}</link> and
|
||||||
<link linkend="tips.componentized.templates">Componentized Templates</link>.
|
<link linkend="tips.componentized.templates">Componentized Templates</link>.
|
||||||
|
@@ -76,16 +76,16 @@
|
|||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<para>
|
||||||
Template sections are used for looping over arrays of data. All
|
Template sections are used for looping over arrays of data. All
|
||||||
<emphasis>section</emphasis> tags must be paired with
|
<emphasis>{section}</emphasis> tags must be paired with
|
||||||
<emphasis>/section</emphasis> tags. Required parameters are
|
<emphasis>{/section}</emphasis> tags. Required parameters are
|
||||||
<emphasis>name</emphasis> and <emphasis>loop</emphasis>. The name
|
<emphasis>name</emphasis> and <emphasis>loop</emphasis>. The name
|
||||||
of the section can be anything you like, made up of letters,
|
of the {section} can be anything you like, made up of letters,
|
||||||
numbers and underscores. Sections can be nested, and the nested
|
numbers and underscores. Sections can be nested, and the nested
|
||||||
section names must be unique from each other. The loop variable
|
section names must be unique from each other. The loop variable
|
||||||
(usually an array of values) determines the number of times the
|
(usually an array of values) determines the number of times the
|
||||||
section will loop. When printing a variable within a section, the
|
section will loop. When printing a variable within a section, the
|
||||||
section name must be given next to variable name within brackets
|
section name must be given next to variable name within brackets
|
||||||
[]. <emphasis>sectionelse</emphasis> is
|
[]. <emphasis>{sectionelse}</emphasis> is
|
||||||
executed when there are no values in the loop variable.
|
executed when there are no values in the loop variable.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
@@ -262,7 +262,8 @@
|
|||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
Sections also have their own variables that handle section properties.
|
Sections also have their own variables that handle section properties.
|
||||||
These are indicated like so: {$smarty.section.sectionname.varname}
|
These are indicated like so:
|
||||||
|
<link linkend="language.variables.smarty.loops">{$smarty.section.sectionname.varname}</link>
|
||||||
</para>
|
</para>
|
||||||
<note>
|
<note>
|
||||||
<para>
|
<para>
|
||||||
@@ -631,7 +632,7 @@
|
|||||||
</screen>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
See also <link linkend="language.function.foreach">foreach</link>
|
See also <link linkend="language.function.foreach">{foreach}</link>
|
||||||
and <link linkend="language.variables.smarty.loops">$smarty.section</link>.
|
and <link linkend="language.variables.smarty.loops">$smarty.section</link>.
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<para>
|
||||||
fetch is used to fetch files from the local file system, http, or
|
{fetch} is used to fetch files from the local file system, http, or
|
||||||
ftp and display the contents. If the file name begins with
|
ftp and display the contents. If the file name begins with
|
||||||
"http://", the web site page will be fetched and displayed. If the
|
"http://", the web site page will be fetched and displayed. If the
|
||||||
file name begins with "ftp://", the file will be fetched from the
|
file name begins with "ftp://", the file will be fetched from the
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
</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
|
||||||
fetch function will be assigned to this template variable instead of
|
{fetch} function will be assigned to this template variable instead of
|
||||||
being output to the template. (new in Smarty 1.5.0)
|
being output to the template. (new in Smarty 1.5.0)
|
||||||
</para>
|
</para>
|
||||||
<note>
|
<note>
|
||||||
@@ -88,7 +88,11 @@
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
See also <link linkend="api.fetch">api fetch()</link>.
|
See also
|
||||||
|
<link linkend="language.function.capture">{capture}</link>,
|
||||||
|
<link linkend="language.function.eval">{eval}</link>
|
||||||
|
and
|
||||||
|
<link linkend="api.fetch">fetch()</link>.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -222,7 +222,7 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<para>
|
||||||
html_select_date is a custom function that creates date dropdowns
|
{html_select_date} is a custom function that creates date dropdowns
|
||||||
for you. It can display any or all of year, month, and day.
|
for you. It can display any or all of year, month, and day.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
@@ -331,7 +331,7 @@
|
|||||||
</screen>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
See also <link linkend="language.function.html.select.time">html_select_time</link>,
|
See also <link linkend="language.function.html.select.time">{html_select_time}</link>,
|
||||||
<link linkend="language.modifier.date.format">date_format</link>,
|
<link linkend="language.modifier.date.format">date_format</link>,
|
||||||
<link linkend="language.variables.smarty.now">$smarty.now</link>
|
<link linkend="language.variables.smarty.now">$smarty.now</link>
|
||||||
and <link linkend="tips.dates">date tips</link>.
|
and <link linkend="tips.dates">date tips</link>.
|
||||||
|
@@ -133,7 +133,7 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<para>
|
||||||
html_select_time is a custom function that
|
{html_select_time} is a custom function that
|
||||||
creates time dropdowns for you. It can display
|
creates time dropdowns for you. It can display
|
||||||
any or all of hour, minute, second and
|
any or all of hour, minute, second and
|
||||||
meridian.
|
meridian.
|
||||||
@@ -142,7 +142,8 @@
|
|||||||
The time-attribute can have different
|
The time-attribute can have different
|
||||||
formats. It can be a unique timestamp or a
|
formats. It can be a unique timestamp or a
|
||||||
string of the format YYYYMMDDHHMMSS or a string
|
string of the format YYYYMMDDHHMMSS or a string
|
||||||
that is parseable by php's strtotime().
|
that is parseable by php's
|
||||||
|
<ulink url="&url.php-manual;strtotime">strtotime()</ulink>.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>html_select_time</title>
|
<title>html_select_time</title>
|
||||||
@@ -313,6 +314,12 @@
|
|||||||
]]>
|
]]>
|
||||||
</screen>
|
</screen>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="language.variables.smarty.now">$smarty.now</link>,
|
||||||
|
<link linkend="language.function.html.select.date">{html_select_date}</link>
|
||||||
|
and <link linkend="tips.dates">date tips</link>.
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -61,6 +61,14 @@
|
|||||||
declared trusted in the <link linkend="variable.security.settings">
|
declared trusted in the <link linkend="variable.security.settings">
|
||||||
$security_settings['MODIFIER_FUNCS']</link>-array.
|
$security_settings['MODIFIER_FUNCS']</link>-array.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="api.register.modifier">register_modifier()</link>,
|
||||||
|
<link linkend="api.register.function">register_function()</link>,
|
||||||
|
<link linkend="plugins">Extending Smarty with plugins</link>
|
||||||
|
and
|
||||||
|
<link linkend="plugins.modifiers">modifiers</link>,
|
||||||
|
</para>
|
||||||
|
|
||||||
&designers.language-modifiers.language-modifier-cat;
|
&designers.language-modifiers.language-modifier-cat;
|
||||||
&designers.language-modifiers.language-modifier-capitalize;
|
&designers.language-modifiers.language-modifier-capitalize;
|
||||||
|
@@ -37,9 +37,11 @@
|
|||||||
</tgroup>
|
</tgroup>
|
||||||
</informaltable>
|
</informaltable>
|
||||||
<para>
|
<para>
|
||||||
This formats a date and time into the given <ulink url="&url.php-manual;strftime">strftime()</ulink> format.
|
This formats a date and time into the given
|
||||||
|
<ulink url="&url.php-manual;strftime">strftime()</ulink> format.
|
||||||
Dates can be passed to Smarty as unix timestamps, mysql timestamps
|
Dates can be passed to Smarty as unix timestamps, mysql timestamps
|
||||||
or any string made up of month day year (parsable by <ulink url="&url.php-manual;strtotime">strtotime</ulink>).
|
or any string made up of month day year (parsable by
|
||||||
|
<ulink url="&url.php-manual;strtotime">strtotime()</ulink>).
|
||||||
Designers can then use date_format to have complete control of the
|
Designers can then use date_format to have complete control of the
|
||||||
formatting of the date. If the date passed to date_format is empty
|
formatting of the date. If the date passed to date_format is empty
|
||||||
and a second parameter is passed, that will be used as the date to
|
and a second parameter is passed, that will be used as the date to
|
||||||
@@ -173,7 +175,8 @@ Monday, February 5, 2001
|
|||||||
%U - week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week
|
%U - week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
%V - The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week.
|
%V - The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current
|
||||||
|
year, and with Monday as the first day of the week.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
%w - day of the week as a decimal, Sunday being 0
|
%w - day of the week as a decimal, Sunday being 0
|
||||||
@@ -238,3 +241,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
|||||||
vim: et tw=78 syn=sgml
|
vim: et tw=78 syn=sgml
|
||||||
vi: ts=1 sw=1
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@@ -88,9 +88,11 @@
|
|||||||
<sect2 id="language.variables.smarty.capture">
|
<sect2 id="language.variables.smarty.capture">
|
||||||
<title>{$smarty.capture}</title>
|
<title>{$smarty.capture}</title>
|
||||||
<para>
|
<para>
|
||||||
The output captured via <link linkend="language.function.capture">{capture}..{/capture}</link> construct can be
|
The output captured via
|
||||||
|
<link linkend="language.function.capture">{capture}..{/capture}</link>
|
||||||
|
construct can be
|
||||||
accessed using {$smarty} variable. See section on
|
accessed using {$smarty} variable. See section on
|
||||||
<link linkend="language.function.capture">capture</link> for an example.
|
<link linkend="language.function.capture">{capture}</link> for an example.
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
@@ -102,7 +104,7 @@
|
|||||||
linkend="language.config.variables">config variables</link>.
|
linkend="language.config.variables">config variables</link>.
|
||||||
{$smarty.config.foo} is a synonym for {#foo#}. See the section on
|
{$smarty.config.foo} is a synonym for {#foo#}. See the section on
|
||||||
<link
|
<link
|
||||||
linkend="language.function.config.load">config_load</link> for an example.
|
linkend="language.function.config.load">{config_load}</link> for an example.
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
@@ -110,8 +112,8 @@
|
|||||||
<title>{$smarty.section}, {$smarty.foreach}</title>
|
<title>{$smarty.section}, {$smarty.foreach}</title>
|
||||||
<para>
|
<para>
|
||||||
{$smarty} variable can be used to refer to
|
{$smarty} variable can be used to refer to
|
||||||
<link linkend="language.function.section">'section'</link> and
|
<link linkend="language.function.section">{section}</link> and
|
||||||
<link linkend="language.function.foreach">'foreach'</link>
|
<link linkend="language.function.foreach">{foreach}</link>
|
||||||
loop properties.
|
loop properties.
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
keep template syntax to a minimum.
|
keep template syntax to a minimum.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
If <link linkend="variable.security">security is enabled</link>,
|
If <link linkend="variable.security">$security</link> is enabled,
|
||||||
no private methods or functions can be accessed
|
no private methods or functions can be accessed
|
||||||
(begininning with "_"). If a method and property of the same name exist,
|
(begininning with "_"). If a method and property of the same name exist,
|
||||||
the method will be used.
|
the method will be used.
|
||||||
@@ -44,7 +44,9 @@
|
|||||||
template
|
template
|
||||||
(<literal>{foobar->meth2}...{/foobar->meth2}</literal>) and
|
(<literal>{foobar->meth2}...{/foobar->meth2}</literal>) and
|
||||||
the parameters to the methods have the same synopsis as the
|
the parameters to the methods have the same synopsis as the
|
||||||
parameters for block-function-plugins: They get 4 parameters
|
parameters for
|
||||||
|
<link linkend="plugins.block.functions">block-function-plugins</link>:
|
||||||
|
They get 4 parameters
|
||||||
<parameter>$params</parameter>,
|
<parameter>$params</parameter>,
|
||||||
<parameter>$content</parameter>,
|
<parameter>$content</parameter>,
|
||||||
<parameter>&$smarty</parameter> and
|
<parameter>&$smarty</parameter> and
|
||||||
@@ -117,3 +119,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
|||||||
vim: et tw=78 syn=sgml
|
vim: et tw=78 syn=sgml
|
||||||
vi: ts=1 sw=1
|
vi: ts=1 sw=1
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
@@ -44,7 +44,7 @@ $smarty->assign_by_ref('Address', $address);
|
|||||||
See also <link linkend="api.assign">assign()</link>,
|
See also <link linkend="api.assign">assign()</link>,
|
||||||
<link linkend="api.clear.all.assign">clear_all_assign()</link>,
|
<link linkend="api.clear.all.assign">clear_all_assign()</link>,
|
||||||
<link linkend="api.append">append()</link>
|
<link linkend="api.append">append()</link>
|
||||||
and <link linkend="language.function.assign">{assign} function</link>
|
and <link linkend="language.function.assign">{assign}</link>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
@@ -40,7 +40,7 @@ $smarty->assign(array('city' => 'Lincoln', 'state' => 'Nebraska'));
|
|||||||
See also <link linkend="api.assign.by.ref">assign_by_ref()</link>,
|
See also <link linkend="api.assign.by.ref">assign_by_ref()</link>,
|
||||||
<link linkend="api.clear.assign">clear_assign()</link>,
|
<link linkend="api.clear.assign">clear_assign()</link>,
|
||||||
<link linkend="api.append">append()</link>,
|
<link linkend="api.append">append()</link>,
|
||||||
<link linkend="language.function.assign">{assign}</link>.
|
<link linkend="language.function.assign">{assign}</link>,
|
||||||
and
|
and
|
||||||
<link linkend="api.get.template.vars">get_template_vars()</link>
|
<link linkend="api.get.template.vars">get_template_vars()</link>
|
||||||
</para>
|
</para>
|
||||||
|
@@ -35,13 +35,11 @@ print_r($config_vars);
|
|||||||
<para>
|
<para>
|
||||||
See also
|
See also
|
||||||
<link linkend="api.clear.config">clear_config()</link>,
|
<link linkend="api.clear.config">clear_config()</link>,
|
||||||
<link linkend="language.function.config.load">{config_load}</link>
|
<link linkend="language.function.config.load">{config_load}</link>,
|
||||||
|
<link linkend="api.config.load">config_load()</link>
|
||||||
and
|
and
|
||||||
<link linkend="api.config.load">config_load()</link>,
|
<link linkend="api.get.template.vars">get_template_vars()</link>.
|
||||||
|
|
||||||
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -32,6 +32,14 @@ print_r($tpl_vars);
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also <link linkend="api.assign">assign()</link>,
|
||||||
|
<link linkend="language.function.assign">{assign}</link>,
|
||||||
|
<link linkend="api.clear.assign">clear_assign()</link>
|
||||||
|
and
|
||||||
|
<link linkend="api.get.config.vars">get_config_vars()</link>
|
||||||
|
</para>
|
||||||
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -43,6 +43,16 @@ $smarty->register_modifier("sslash", "stripslashes");
|
|||||||
]]>
|
]]>
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="api.unregister.modifier">unregister_modifier()</link>,
|
||||||
|
<link linkend="api.register.function">register_function()</link>,
|
||||||
|
<link linkend="language.modifiers">modifiers</link>,
|
||||||
|
|
||||||
|
<link linkend="plugins">Extending Smarty with plugins</link>
|
||||||
|
and
|
||||||
|
<link linkend="plugins.modifiers">Plugin modifiers</link>,
|
||||||
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
of the manual for examples.
|
of the manual for examples.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
See Also <link linkend="api.unregister.object">unregister_object</link>.
|
See Also <link linkend="api.unregister.object">unregister_object()</link>.
|
||||||
</para>
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
|
@@ -16,6 +16,14 @@
|
|||||||
accept either a path to the template on the filesystem or a
|
accept either a path to the template on the filesystem or a
|
||||||
resource string specifying the template.
|
resource string specifying the template.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="api.display">display()</link>,
|
||||||
|
<link linkend="api.fetch">fetch()</link>,
|
||||||
|
<link linkend="language.function.include">{include}</link>
|
||||||
|
and
|
||||||
|
<link linkend="language.function.insert">{insert}</link>
|
||||||
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -15,9 +15,18 @@
|
|||||||
<para>
|
<para>
|
||||||
This function can be used to output an error message using Smarty.
|
This function can be used to output an error message using Smarty.
|
||||||
<parameter>level</parameter> parameter can be one of the values
|
<parameter>level</parameter> parameter can be one of the values
|
||||||
used for trigger_error() PHP function, i.e. E_USER_NOTICE,
|
used for
|
||||||
|
<ulink url="&url.php-manual;trigger_error">trigger_error()</ulink>
|
||||||
|
PHP function, i.e. E_USER_NOTICE,
|
||||||
E_USER_WARNING, etc. By default it's E_USER_WARNING.
|
E_USER_WARNING, etc. By default it's E_USER_WARNING.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="variable.error.reporting">$error_reporting</link>,
|
||||||
|
<link linkend="chapter.debugging.console">debugging</link>
|
||||||
|
and
|
||||||
|
<link linkend="smarty.php.errors">Troubleshooting</link>.
|
||||||
|
</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
</refentry>
|
</refentry>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -11,9 +11,13 @@
|
|||||||
Smarty to use the current
|
Smarty to use the current
|
||||||
<link linkend="variable.cache.lifetime">$cache_lifetime</link>
|
<link linkend="variable.cache.lifetime">$cache_lifetime</link>
|
||||||
variable to determine if the
|
variable to determine if the
|
||||||
cache has expired. A value of 2 tells Smarty to use the cache_lifetime
|
cache has expired. A value of 2 tells Smarty to use the
|
||||||
|
<link linkend="variable.cache.lifetime">$cache_lifetime</link>
|
||||||
value at the time the cache was generated. This way you can set the
|
value at the time the cache was generated. This way you can set the
|
||||||
cache_lifetime just before fetching the template to have granular
|
<link linkend="variable.cache.lifetime">$cache_lifetime</link>
|
||||||
|
just before
|
||||||
|
<link linkend="api.fetch">fetching</link>
|
||||||
|
the template to have granular
|
||||||
control over when that particular cache expires.
|
control over when that particular cache expires.
|
||||||
See also <link linkend="api.is.cached">is_cached()</link>.
|
See also <link linkend="api.is.cached">is_cached()</link>.
|
||||||
</para>
|
</para>
|
||||||
|
@@ -6,7 +6,8 @@
|
|||||||
This is the name of the directory where compiled templates are
|
This is the name of the directory where compiled templates are
|
||||||
located. By default this is "./templates_c", meaning that it
|
located. By default this is "./templates_c", meaning that it
|
||||||
will look for the compile directory in the same directory as
|
will look for the compile directory in the same directory as
|
||||||
the executing php script.
|
the executing php script. <emphasis role="bold">This directory must
|
||||||
|
be writeable by the web server.</emphasis>
|
||||||
</para>
|
</para>
|
||||||
<note>
|
<note>
|
||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
@@ -22,6 +23,9 @@
|
|||||||
the web server document root.
|
the web server document root.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
|
<para>
|
||||||
|
See also <link linkend="variable.compile.id">$compile_id</link>.
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -13,7 +13,7 @@
|
|||||||
See also
|
See also
|
||||||
<link linkend="language.function.debug">{debug}</link>,
|
<link linkend="language.function.debug">{debug}</link>,
|
||||||
<link linkend="variable.debug.tpl">$debug_tpl</link>,
|
<link linkend="variable.debug.tpl">$debug_tpl</link>,
|
||||||
and <link linkend="variable.debugging.ctrl">$debuging_ctrl</link>
|
and <link linkend="variable.debugging.ctrl">$debugging_ctrl</link>
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -10,6 +10,13 @@
|
|||||||
linkend="chapter.debugging.console">debugging</link> is enabled this value
|
linkend="chapter.debugging.console">debugging</link> is enabled this value
|
||||||
is ignored and the error-level is left untouched.
|
is ignored and the error-level is left untouched.
|
||||||
</para>
|
</para>
|
||||||
|
<para>
|
||||||
|
See also
|
||||||
|
<link linkend="api.trigger.error">trigger_error()</link>,
|
||||||
|
<link linkend="chapter.debugging.console">debugging</link>
|
||||||
|
and
|
||||||
|
<link linkend="troubleshooting">Troubleshooting</link>.
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
|
@@ -7,7 +7,10 @@
|
|||||||
Default is "{".
|
Default is "{".
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
See also <link linkend="variable.right.delimiter">$right_delimiter</link>.
|
See also <link linkend="variable.right.delimiter">$right_delimiter</link>
|
||||||
|
and
|
||||||
|
<link linkend="language.escaping">escaping smarty parsing</link>
|
||||||
|
.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
@@ -7,7 +7,9 @@
|
|||||||
Default is "}".
|
Default is "}".
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
See also <link linkend="variable.left.delimiter">$left_delimiter</link>.
|
See also <link linkend="variable.left.delimiter">$left_delimiter</link>
|
||||||
|
and
|
||||||
|
<link linkend="language.escaping">escaping smarty parsing</link>.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
@@ -10,9 +10,17 @@
|
|||||||
<note>
|
<note>
|
||||||
<title>Technical Note</title>
|
<title>Technical Note</title>
|
||||||
<para>
|
<para>
|
||||||
Since Smarty-2.6.2 <varname>use_sub_dirs</varname> defaults to false.
|
Since Smarty-2.6.2 <varname>$use_sub_dirs</varname> defaults to false.
|
||||||
</para>
|
</para>
|
||||||
</note>
|
</note>
|
||||||
|
<para>
|
||||||
|
See also <link linkend="variable.template.dir">$template_dir</link>,
|
||||||
|
<link linkend="variable.compile.dir">$compile_dir</link>,
|
||||||
|
<link linkend="variable.config.dir">$config_dir</link>,
|
||||||
|
<link linkend="variable.plugins.dir">$plugins_dir</link>
|
||||||
|
and
|
||||||
|
<link linkend="variable.cache.dir">$cache_dir</link>.
|
||||||
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
@@ -3,8 +3,10 @@
|
|||||||
<sect1 id="caching.multiple.caches">
|
<sect1 id="caching.multiple.caches">
|
||||||
<title>Multiple Caches Per Page</title>
|
<title>Multiple Caches Per Page</title>
|
||||||
<para>
|
<para>
|
||||||
You can have multiple cache files for a single call to display() or
|
You can have multiple cache files for a single call to
|
||||||
fetch(). Let's say that a call to display('index.tpl') may have several
|
<link linkend="api.display">display()</link>
|
||||||
|
or <link linkend="api.fetch">fetch()</link>.
|
||||||
|
Let's say that a call to display('index.tpl') may have several
|
||||||
different output contents depending on some condition, and you want
|
different output contents depending on some condition, and you want
|
||||||
separate caches for each one. You can do this by passing a cache_id as the
|
separate caches for each one. You can do this by passing a cache_id as the
|
||||||
second parameter to the function call.
|
second parameter to the function call.
|
||||||
@@ -27,7 +29,9 @@ $smarty->display('index.tpl',$my_cache_id);
|
|||||||
</programlisting>
|
</programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
Above, we are passing the variable $my_cache_id to display() as the
|
Above, we are passing the variable $my_cache_id to
|
||||||
|
<link linkend="api.display">display()</link>
|
||||||
|
as the
|
||||||
cache_id. For each unique value of $my_cache_id, a separate cache will be
|
cache_id. For each unique value of $my_cache_id, a separate cache will be
|
||||||
generated for index.tpl. In this example, "article_id" was passed in the
|
generated for index.tpl. In this example, "article_id" was passed in the
|
||||||
URL and is used as the cache_id.
|
URL and is used as the cache_id.
|
||||||
@@ -77,7 +81,8 @@ $smarty->display('index.tpl',$my_cache_id);
|
|||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
You can clear all caches for a particular cache_id by passing null as the
|
You can clear all caches for a particular cache_id by passing null as the
|
||||||
first parameter to clear_cache().
|
first parameter to
|
||||||
|
<link linkend="api.clear.cache">clear_cache()</link>.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>clearing all caches for a particular cache_id</title>
|
<title>clearing all caches for a particular cache_id</title>
|
||||||
|
Reference in New Issue
Block a user