From 85e9427ea8969f1611c3bef21c37423c7ad6ddeb Mon Sep 17 00:00:00 2001 From: pete_morgan Date: Sun, 5 Jun 2005 19:46:19 +0000 Subject: [PATCH] Clean up WS, more linking and examples --- docs/en/designers/config-files.xml | 97 +++++++++++++------ .../language-function-include.xml | 6 +- .../language-function-ldelim.xml | 23 +++++ .../language-function-literal.xml | 24 +++-- .../language-function-html-checkboxes.xml | 12 ++- .../language-modifier-date-format.xml | 5 +- .../language-assigned-variables.xml | 6 +- .../variable-config-overwrite.xml | 59 +++++++++-- 8 files changed, 170 insertions(+), 62 deletions(-) diff --git a/docs/en/designers/config-files.xml b/docs/en/designers/config-files.xml index c67c3a4b..eed22a5d 100644 --- a/docs/en/designers/config-files.xml +++ b/docs/en/designers/config-files.xml @@ -3,11 +3,16 @@ Config Files - Config files are handy for designers to manage global template - variables from one file. One example is template colors. Normally if - you wanted to change the color scheme of an application, you would have - to go through each and every template file and change the colors. With - a config file, the colors can be kept in one place, and only one file + Config files are handy for designers to manage global + template + variables from one file. One example is template colors. + Normally if + you wanted to change the color scheme of an application, you + would have + to go through each and every template file and change the + colors. With + a config file, the colors can be kept in one place, and only + one file needs to be updated. @@ -41,42 +46,75 @@ pass=foobar Values of - config file variables + config file + variables can be in quotes, but not necessary. - You can use either single or double quotes. If you have a value that - spans more than one line, enclose the entire value with triple quotes - ("""). You can put comments into config files by any syntax that is not - a valid config file syntax. We recommend using a # + You can use either single or double quotes. If you have a + value that + spans more than one line, enclose the entire value with + triple quotes + ("""). You can put comments into config files by any syntax + that is not + a valid config file syntax. We recommend using a + # (hash) at the beginning of the line. - This config file example has two sections. Section names are enclosed in - brackets []. Section names can be arbitrary strings not containing - [ or ] symbols. The four variables - at the top are global variables, or variables not within a section. - These variables are always loaded from the config file. If a particular - section is loaded, then the global variables and the variables from that - section are also loaded. If a variable exists both as a global and in a - section, the section variable is used. If you name two variables the - same within a section, the last one will be used. (see - $config_overwrite) + This config file example has two sections. Section names are + enclosed in + brackets []. Section names can be arbitrary strings not + containing + [ or ] symbols. The + four variables + at the top are global variables, or variables not within a + section. + These variables are always loaded from the config file. If a + particular + section is loaded, then the global variables and the + variables from that + section are also loaded. If a variable exists both as a + global and in a + section, the section variable is used. If you name two + variables the + same within a section, the last one will be used unless + + $config_overwrite + is disabled. - Config files are loaded into templates with the built-in function + Config files are loaded into templates with the built-in + function {config_load} - , and + linkend="language.function.config.load"> + {config_load} + (see also config_load(). + linkend="api.config.load">config_load() ). - You can hide variables or entire sections by prepending the variable - name or section name with a period. This is useful if your application - reads the config files and gets sensitive data from them that the - template engine does not need. If you have third parties doing template - editing, you can be certain that they cannot read sensitive data from + You can hide variables or entire sections by prepending the + variable + name or section name with a period. This is useful if your + application + reads the config files and gets sensitive data from them + that the + template engine does not need. If you have third parties + doing template + editing, you can be certain that they cannot read sensitive + data from the config file by loading it into the template. + + + See also + {config_load}, + $config_overwrite, + get_config_vars(), + clear_config() + and + config_load() + + + 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 d558d933..f875ddcd 100644 --- a/docs/en/designers/language-builtin-functions/language-function-include.xml +++ b/docs/en/designers/language-builtin-functions/language-function-include.xml @@ -109,8 +109,8 @@ {include} and assign to variable - This example assign the contents of nav.tpl to a variable - and outputs at the top of page and the bottom. + This example assigns the contents of nav.tpl to the $navbar variable, + which is then output at the top and bottom of the page. - ]]> +]]> diff --git a/docs/en/designers/language-builtin-functions/language-function-ldelim.xml b/docs/en/designers/language-builtin-functions/language-function-ldelim.xml index c858afc3..0bdffe6e 100644 --- a/docs/en/designers/language-builtin-functions/language-function-ldelim.xml +++ b/docs/en/designers/language-builtin-functions/language-function-ldelim.xml @@ -29,6 +29,29 @@ {funcname} is how functions look in Smarty! ]]> + Another example with some javascript + + +function foo() {ldelim} + ... code ... +{rdelim} + +]]> + + + will output + + + +function foo() { + .... code ... +} + +]]> + + See also Escaping Smarty Parsing diff --git a/docs/en/designers/language-builtin-functions/language-function-literal.xml b/docs/en/designers/language-builtin-functions/language-function-literal.xml index 0e4d7dd8..dce75f72 100644 --- a/docs/en/designers/language-builtin-functions/language-function-literal.xml +++ b/docs/en/designers/language-builtin-functions/language-function-literal.xml @@ -19,19 +19,17 @@ - - - + {/literal} ]]> diff --git a/docs/en/designers/language-custom-functions/language-function-html-checkboxes.xml b/docs/en/designers/language-custom-functions/language-function-html-checkboxes.xml index 34a136b3..640edfa6 100644 --- a/docs/en/designers/language-custom-functions/language-function-html-checkboxes.xml +++ b/docs/en/designers/language-custom-functions/language-function-html-checkboxes.xml @@ -95,7 +95,8 @@ $smarty->assign('cust_names', array( 'Joe Schmoe', 'Jack Smith', 'Jane Johnson', - 'Charlie Brown')); + 'Charlie Brown') + ); $smarty->assign('customer_id', 1001); ?> @@ -118,10 +119,11 @@ where template is assign('cust_checkboxes', array( - 1000 => 'Joe Schmoe', - 1001 => 'Jack Smith', - 1002 => 'Jane Johnson', - 1003 => 'Charlie Brown')); + 1000 => 'Joe Schmoe', + 1001 => 'Jack Smith', + 1002 => 'Jane Johnson', + 1003 => 'Charlie Brown') + ); $smarty->assign('customer_id', 1001); ?> diff --git a/docs/en/designers/language-modifiers/language-modifier-date-format.xml b/docs/en/designers/language-modifiers/language-modifier-date-format.xml index 07ec0454..65842121 100644 --- a/docs/en/designers/language-modifiers/language-modifier-date-format.xml +++ b/docs/en/designers/language-modifiers/language-modifier-date-format.xml @@ -215,10 +215,11 @@ Monday, February 5, 2001 Programmers note - date_format is essentially a wrapper to PHP's + date_format is essentially a wrapper to PHP's strftime() function. You may have more or less conversion specifiers available depending - on your system's strftime() function where PHP was compiled. Check your + on your system's strftime() + function where PHP was compiled. Check your system's manpage for a full list of valid specifiers. diff --git a/docs/en/designers/language-variables/language-assigned-variables.xml b/docs/en/designers/language-variables/language-assigned-variables.xml index 16c84038..d8392353 100644 --- a/docs/en/designers/language-variables/language-assigned-variables.xml +++ b/docs/en/designers/language-variables/language-assigned-variables.xml @@ -69,7 +69,9 @@ $smarty->assign('Contacts', array('fax' => '555-222-9876', 'email' => 'zaphod@slartibartfast.com', 'phone' => array('home' => '555-444-3333', - 'cell' => '555-111-1234'))); + 'cell' => '555-111-1234') + ) + ); $smarty->display('index.tpl'); ?> ]]> @@ -110,7 +112,6 @@ zaphod@slartibartfast.com
assign('Contacts', array( '555-222-9876', 'zaphod@slartibartfast.com', @@ -118,7 +119,6 @@ $smarty->assign('Contacts', array( '555-111-1234') )); $smarty->display('index.tpl'); - ?> ]]> diff --git a/docs/en/programmers/api-variables/variable-config-overwrite.xml b/docs/en/programmers/api-variables/variable-config-overwrite.xml index 882fcf8d..353afee1 100644 --- a/docs/en/programmers/api-variables/variable-config-overwrite.xml +++ b/docs/en/programmers/api-variables/variable-config-overwrite.xml @@ -1,13 +1,58 @@ - - $config_overwrite - - If set to true, variables read in from config files will overwrite each - other. Otherwise, the variables will be pushed onto an array. This is - helpful if you want to store arrays of data in config files, just list - each element multiple times. true by default. + + $config_overwrite + + If set to true (by default), variables read in from + config files will overwrite each + other. Otherwise, the variables will be pushed onto an array. This is + helpful if you want to store arrays of data in config files, just list + each element multiple times. + + + + Array of config variables + + This examples uses + {cycle} to + ouput a table with alternating red/gree/blue row colors + with $config_overwrite = false. + + The config file. + + + + + The template with a + {section} loop. + + + {section name=r loop=$rows} + + ....etc.... + + {/section} + +]]> + + + + See also + {config_load}, + config files, + get_config_vars(), + clear_config() + and + config_load(). + +