From c666426130d6ea682dc8c5cbc6f93e7baf5d1179 Mon Sep 17 00:00:00 2001 From: pete_morgan Date: Tue, 13 Sep 2005 18:41:44 +0000 Subject: [PATCH] Moved description to top of page and some tweaks --- .../language-function-capture.xml | 48 +++++++++++----- .../language-function-config-load.xml | 16 ++++-- .../language-function-foreach.xml | 44 ++++++++------- .../language-function-if.xml | 9 ++- .../language-function-include-php.xml | 30 +++++----- .../language-function-include.xml | 56 +++++++++++-------- .../language-function-insert.xml | 16 +++--- .../language-function-php.xml | 16 +++++- .../language-function-section.xml | 34 +++++------ .../language-function-strip.xml | 2 +- 10 files changed, 168 insertions(+), 103 deletions(-) diff --git a/docs/en/designers/language-builtin-functions/language-function-capture.xml b/docs/en/designers/language-builtin-functions/language-function-capture.xml index e07812a7..2e89b834 100644 --- a/docs/en/designers/language-builtin-functions/language-function-capture.xml +++ b/docs/en/designers/language-builtin-functions/language-function-capture.xml @@ -2,6 +2,20 @@ {capture} + + + {capture} is used to collect the output of the template into a + variable instead of displaying it. Any content between {capture + name="foo"} and {/capture} is collected into the variable specified + in the name attribute. The captured content can be used in the + template from the special variable $smarty.capture.foo + where "foo" is the value passed in the name attribute. If you do not + supply a name attribute, then "default" will be used as the name. All {capture} + commands must be paired with {/capture}. You can nest capture commands. + + + @@ -36,17 +50,7 @@ - - {capture} is used to collect the output of the template into a - variable instead of displaying it. Any content between {capture - name="foo"} and {/capture} is collected into the variable specified - in the name attribute. The captured content can be used in the - template from the special variable $smarty.capture.foo - where "foo" is the value passed in the name attribute. If you do not - supply a name attribute, then "default" will be used. All {capture} - commands must be paired with {/capture}. You can nest capture commands. - + Technical Note @@ -61,7 +65,7 @@ linkend="language.function.insert">{insert} output. If you have caching - turned on and you have + enabled and you have {insert} commands that you expect to run within cached content, do not capture this content. @@ -74,7 +78,7 @@ + + + capturing content to a variable + + + + + + See also diff --git a/docs/en/designers/language-builtin-functions/language-function-config-load.xml b/docs/en/designers/language-builtin-functions/language-function-config-load.xml index 351981ed..1ec978cb 100644 --- a/docs/en/designers/language-builtin-functions/language-function-config-load.xml +++ b/docs/en/designers/language-builtin-functions/language-function-config-load.xml @@ -2,6 +2,12 @@ {config_load} + + {config_load} is used for loading config + #variables# from a + configuration file into the template. + + @@ -63,11 +69,7 @@ - - {config_load} is used for loading config - #variables# from a - configuration file into the template. - + {config_load} @@ -146,6 +148,10 @@ pageTitle = "Customer Info" + +See $config_overwrite for arrays of config variables + + See also Config files, Config variables, diff --git a/docs/en/designers/language-builtin-functions/language-function-foreach.xml b/docs/en/designers/language-builtin-functions/language-function-foreach.xml index ee139936..e20d0e27 100644 --- a/docs/en/designers/language-builtin-functions/language-function-foreach.xml +++ b/docs/en/designers/language-builtin-functions/language-function-foreach.xml @@ -2,6 +2,28 @@ {foreach},{foreachelse} + + {foreach} loops are an alternative to + {section} + loops. {foreach} is used to loop over a + single associative array. The syntax for + {foreach} is much easier than + {section}, but as a tradeoff it + can only be used + for a single array. {foreach} tags must be + paired with {/foreach} tags. Required parameters + are from and item. The + name of the {foreach} loop can be anything you like, made up of + letters, numbers and underscores. {foreach} + loops can be nested, and the nested {foreach} names must be unique + from each other. The from variable (usually an + array of values) determines the number of times + {foreach} will loop. + {foreachelse} is executed when there are no + values in the from variable. + + @@ -52,27 +74,7 @@ - - {foreach} loops are an alternative to - {section} - loops. {foreach} is used to loop over a - single associative array. The syntax for - {foreach} is much easier than - {section}, but as a tradeoff it - can only be used - for a single array. {foreach} tags must be - paired with {/foreach} tags. Required parameters - are from and item. The - name of the {foreach} loop can be anything you like, made up of - letters, numbers and underscores. {foreach} - loops can be nested, and the nested {foreach} names must be unique - from each other. The from variable (usually an - array of values) determines the number of times - {foreach} will loop. - {foreachelse} is executed when there are no - values in the from variable. - + {foreach} - item diff --git a/docs/en/designers/language-builtin-functions/language-function-if.xml b/docs/en/designers/language-builtin-functions/language-function-if.xml index c06a600c..a221d1df 100644 --- a/docs/en/designers/language-builtin-functions/language-function-if.xml +++ b/docs/en/designers/language-builtin-functions/language-function-if.xml @@ -209,10 +209,17 @@ ... {/if} +{* ------- if with php functions ------- *} {* check for array. *} {if is_array($foo) } - ...do something + ..... {/if} + +{* check for array. *} +{if isset($foo) } + ..... +{/if} + ]]> diff --git a/docs/en/designers/language-builtin-functions/language-function-include-php.xml b/docs/en/designers/language-builtin-functions/language-function-include-php.xml index e808d911..499a953b 100644 --- a/docs/en/designers/language-builtin-functions/language-function-include-php.xml +++ b/docs/en/designers/language-builtin-functions/language-function-include-php.xml @@ -2,6 +2,21 @@ {include_php} + + Technical Note + + {include_php} is pretty much deprecated from Smarty, you can + accomplish the same functionality via a custom template function. + The only reason to use {include_php} is if you really have a need to + quarantine the php function away from the + plugins + directory or your + application code. See the componentized template + example for details. + + + @@ -45,20 +60,7 @@ - - Technical Note - - {include_php} is pretty much deprecated from Smarty, you can - accomplish the same functionality via a custom template function. - The only reason to use {include_php} is if you really have a need to - quarantine the php function away from the - plugins - directory or your - application code. See the componentized template - example for details. - - + {include_php} tags are used to include a php script in your template. If security is enabled, diff --git a/docs/en/designers/language-builtin-functions/language-function-include.xml b/docs/en/designers/language-builtin-functions/language-function-include.xml index f875ddcd..08066054 100644 --- a/docs/en/designers/language-builtin-functions/language-function-include.xml +++ b/docs/en/designers/language-builtin-functions/language-function-include.xml @@ -2,6 +2,19 @@ {include} + + {include} tags are used for including other templates in the current + template. Any variables available in the current template are also + available within the included template. The {include} tag must have + the attribute "file", which contains the template resource path. + + + You can optionally pass the 'assign' attribute, + which will specify a template variable name that the output of + {include} will be assigned to instead of + displayed. + + @@ -44,18 +57,7 @@ - - {include} tags are used for including other templates in the current - template. Any variables available in the current template are also - available within the included template. The {include} tag must have - the attribute "file", which contains the template resource path. - - - You can optionally pass the 'assign' attribute, - which will specify a template variable name that the output of - {include} will be assigned to instead of - displayed. - + function {include} @@ -65,12 +67,12 @@ {$title} -{include file="page_header.tpl"} +{include file='page_header.tpl'} {* body of template goes here *} -{include file="/$tpl_name.tpl"} <-- will replace $tpl_name with value +{include file="$tpl_name.tpl"} <-- will replace $tpl_name with value -{include file="page_footer.tpl"} +{include file='page_footer.tpl'} ]]> @@ -87,11 +89,11 @@ {include} passing variables where header.tpl could be @@ -115,13 +117,13 @@ -{include file="nav.tpl" assign="navbar"} -{include file="header.tpl" title="Main Menu" table_bgcolor="#c0c0c0"} +{include file='nav.tpl' assign=navbar} +{include file='header.tpl' title='Main Menu' table_bgcolor='#effeef'} {$navbar} {* body of template goes here *} -{include file="footer.tpl" logo="http://my.example.com/logo.gif"} +{include file='footer.tpl' logo='http://my.example.com/logo.gif'} {$navbar} ]]> @@ -140,16 +142,22 @@ diff --git a/docs/en/designers/language-builtin-functions/language-function-insert.xml b/docs/en/designers/language-builtin-functions/language-function-insert.xml index 0b040a27..4677507a 100644 --- a/docs/en/designers/language-builtin-functions/language-function-insert.xml +++ b/docs/en/designers/language-builtin-functions/language-function-insert.xml @@ -2,6 +2,14 @@ {insert} + + {insert} tags work much like {include} tags, + except that {insert} tags are NOT cached when you have + template caching enabled. They + will be executed on every invocation of the template. + + @@ -52,13 +60,7 @@ - - Insert tags work much like {include} tags, - except that {insert} tags are not cached when you have - template caching enabled. They - will be executed on every invocation of the template. - + Let's say you have a template with a banner slot at the top of the page. The banner can contain any mixture of HTML, images, diff --git a/docs/en/designers/language-builtin-functions/language-function-php.xml b/docs/en/designers/language-builtin-functions/language-function-php.xml index 65b23aaa..8a206c0e 100644 --- a/docs/en/designers/language-builtin-functions/language-function-php.xml +++ b/docs/en/designers/language-builtin-functions/language-function-php.xml @@ -15,7 +15,7 @@ {php} // including a php script directly // from the template. - include("/path/to/display_weather.php"); + include('/path/to/display_weather.php'); {/php} ]]> @@ -29,6 +29,20 @@ + + {php} tags with global + + + + + See also $php_handling, diff --git a/docs/en/designers/language-builtin-functions/language-function-section.xml b/docs/en/designers/language-builtin-functions/language-function-section.xml index 55aab77c..8b9655e9 100644 --- a/docs/en/designers/language-builtin-functions/language-function-section.xml +++ b/docs/en/designers/language-builtin-functions/language-function-section.xml @@ -2,6 +2,23 @@ {section},{sectionelse} + + Template sections are used for looping over + arrays of data + (just like {foreach}). All + {section} tags must be paired with + {/section} tags. Required parameters are + name and loop. The name + of the {section} can be anything you like, made up of letters, + numbers and underscores. Sections can be nested, and the nested + section names must be unique from each other. The loop variable + (usually an array of values) determines the number of times the + section will loop. When printing a variable within a section, the + section name must be given next to variable name within brackets + []. {sectionelse} is + executed when there are no values in the loop variable. + + @@ -74,22 +91,7 @@ - - Template sections are used for looping over - arrays of data - (just like {foreach}). All - {section} tags must be paired with - {/section} tags. Required parameters are - name and loop. The name - of the {section} can be anything you like, made up of letters, - numbers and underscores. Sections can be nested, and the nested - section names must be unique from each other. The loop variable - (usually an array of values) determines the number of times the - section will loop. When printing a variable within a section, the - section name must be given next to variable name within brackets - []. {sectionelse} is - executed when there are no values in the loop variable. - + {section} diff --git a/docs/en/designers/language-builtin-functions/language-function-strip.xml b/docs/en/designers/language-builtin-functions/language-function-strip.xml index 4e0f612e..bcf5da2f 100644 --- a/docs/en/designers/language-builtin-functions/language-function-strip.xml +++ b/docs/en/designers/language-builtin-functions/language-function-strip.xml @@ -47,7 +47,7 @@ ]]>