mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
add math and default_resource_type to docs
This commit is contained in:
@@ -109,7 +109,7 @@
|
|||||||
{html_options values=$vals selected=$selected output=$output}
|
{html_options values=$vals selected=$selected output=$output}
|
||||||
</SELECT></programlisting>
|
</SELECT></programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="language.syntax.quotes">
|
<sect1 id="language.syntax.quotes">
|
||||||
<title>Embedding Vars in Double Quotes</title>
|
<title>Embedding Vars in Double Quotes</title>
|
||||||
<para>
|
<para>
|
||||||
@@ -134,6 +134,29 @@ PRACTICAL EXAMPLES:
|
|||||||
{cycle values="one,two,`$smarty.config.myval`"} <-- must have backticks</programlisting>
|
{cycle values="one,two,`$smarty.config.myval`"} <-- must have backticks</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
<sect1 id="language.math">
|
||||||
|
<title>Math</title>
|
||||||
|
<para>
|
||||||
|
Math can be applied directly to variable values.
|
||||||
|
</para>
|
||||||
|
<example>
|
||||||
|
<title>math examples</title>
|
||||||
|
<programlisting>
|
||||||
|
{$foo + 1}
|
||||||
|
|
||||||
|
{$foo * $bar}
|
||||||
|
|
||||||
|
{* some more complicated examples *}
|
||||||
|
|
||||||
|
{$foo->bar - $bar[1] * $baz->foo->bar() - 3 * 7}
|
||||||
|
|
||||||
|
{if ($foo+$bar.test%$baz*134232+10+$b+10)}
|
||||||
|
|
||||||
|
{$foo|truncate:"`$fooTruncCount / $barTruncFactor -1`"}
|
||||||
|
|
||||||
|
{assign var="foo" value="`$foo + $bar`"}</programlisting>
|
||||||
|
</example>
|
||||||
|
</sect1>
|
||||||
|
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
|
@@ -495,6 +495,15 @@ $smarty->autoload_filters = array('pre' => array('trim', 'stamp'),
|
|||||||
{$var|smarty:nodefaults}.
|
{$var|smarty:nodefaults}.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
<sect1 id="variable.default.resource.type">
|
||||||
|
<title>$default_resource_type</title>
|
||||||
|
<para>
|
||||||
|
This tells smarty what resource type to use implicitly. The default value
|
||||||
|
is 'file', meaning that $smarty->display('index.tpl'); and
|
||||||
|
$smarty->display('file:index.tpl'); are identical in meaning. See the
|
||||||
|
<link linkend="template.resources">resource</link> chapter for details.
|
||||||
|
</para>
|
||||||
|
</sect1>
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
<chapter id="api.functions">
|
<chapter id="api.functions">
|
||||||
@@ -1388,6 +1397,14 @@ $smarty->register_modifier("sslash","stripslashes");
|
|||||||
for more information on how to setup a function for fetching
|
for more information on how to setup a function for fetching
|
||||||
templates.
|
templates.
|
||||||
</para>
|
</para>
|
||||||
|
<note>
|
||||||
|
<title>Technical Note</title>
|
||||||
|
<para>
|
||||||
|
A resource name must be at least two characters in length. One
|
||||||
|
character resource names will be ignored and used as part of the file
|
||||||
|
path, such as $smarty->display('c:/path/to/index.tpl');
|
||||||
|
</para>
|
||||||
|
</note>
|
||||||
<para>
|
<para>
|
||||||
The php-function-array <parameter>resource_funcs</parameter>
|
The php-function-array <parameter>resource_funcs</parameter>
|
||||||
must have 4 or 5 elements. With 4 elements the elements are
|
must have 4 or 5 elements. With 4 elements the elements are
|
||||||
@@ -2265,10 +2282,12 @@ function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=n
|
|||||||
<sect1 id="template.resources">
|
<sect1 id="template.resources">
|
||||||
<title>Resources</title>
|
<title>Resources</title>
|
||||||
<para>
|
<para>
|
||||||
The templates may come from a variety of sources. When you display or
|
The templates may come from a variety of sources. When you display or fetch
|
||||||
fetch a template, or when you include a template from within another
|
a template, or when you include a template from within another template,
|
||||||
template, you supply a resource type, followed by the appropriate path
|
you supply a resource type, followed by the appropriate path and template
|
||||||
and template name.
|
name. If a resource is not explicitly given the value of <link
|
||||||
|
linkend="variable.default.resource.type">$default_resource_type</link> is
|
||||||
|
assumed.
|
||||||
</para>
|
</para>
|
||||||
<sect2 id="templates.from.template.dir">
|
<sect2 id="templates.from.template.dir">
|
||||||
<title>Templates from $template_dir</title>
|
<title>Templates from $template_dir</title>
|
||||||
|
Reference in New Issue
Block a user