From 3f10cac6abbeac272a13ed6737afc512fa2cf544 Mon Sep 17 00:00:00 2001 From: mohrt Date: Thu, 7 Aug 2003 16:30:30 +0000 Subject: [PATCH] add math and default_resource_type to docs --- docs/designers.sgml | 25 ++++++++++++++++++++++++- docs/programmers.sgml | 27 +++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/docs/designers.sgml b/docs/designers.sgml index 36ad681c..46c4df12 100644 --- a/docs/designers.sgml +++ b/docs/designers.sgml @@ -109,7 +109,7 @@ {html_options values=$vals selected=$selected output=$output} </SELECT> - + Embedding Vars in Double Quotes @@ -134,6 +134,29 @@ PRACTICAL EXAMPLES: {cycle values="one,two,`$smarty.config.myval`"} <-- must have backticks + + Math + + Math can be applied directly to variable values. + + + math examples + +{$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`"} + + diff --git a/docs/programmers.sgml b/docs/programmers.sgml index 58fd0085..6a0436e1 100644 --- a/docs/programmers.sgml +++ b/docs/programmers.sgml @@ -495,6 +495,15 @@ $smarty->autoload_filters = array('pre' => array('trim', 'stamp'), {$var|smarty:nodefaults}. + + $default_resource_type + + 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 + resource chapter for details. + + @@ -1388,6 +1397,14 @@ $smarty->register_modifier("sslash","stripslashes"); for more information on how to setup a function for fetching templates. + + Technical Note + + 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'); + + The php-function-array resource_funcs 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 Resources - The templates may come from a variety of sources. When you display or - fetch a template, or when you include a template from within another - template, you supply a resource type, followed by the appropriate path - and template name. + The templates may come from a variety of sources. When you display or fetch + a template, or when you include a template from within another template, + you supply a resource type, followed by the appropriate path and template + name. If a resource is not explicitly given the value of $default_resource_type is + assumed. Templates from $template_dir