diff --git a/docs/en/designers/language-builtin-functions.xml b/docs/en/designers/language-builtin-functions.xml index 12cefd0f..70966028 100644 --- a/docs/en/designers/language-builtin-functions.xml +++ b/docs/en/designers/language-builtin-functions.xml @@ -3,11 +3,20 @@ Built-in Functions - Smarty comes with several built-in functions. Built-in functions - are integral to the template language. You cannot create custom - functions with the same names, nor can you modify built-in functions. + Smarty comes with several built-in functions. These built-in functions + are the integral part of the smarty template engine. You cannot create your own + custom functions + with the same name; and you should not need to + modify the built-in functions. + + + A few on these functions have an assign + attribute which collects + the result the function to a named variable within a template instead of being output; + much like the {assign} function. + &designers.language-builtin-functions.language-function-capture; &designers.language-builtin-functions.language-function-config-load; &designers.language-builtin-functions.language-function-foreach; 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 eadce862..efd761d1 100644 --- a/docs/en/designers/language-builtin-functions/language-function-capture.xml +++ b/docs/en/designers/language-builtin-functions/language-function-capture.xml @@ -4,15 +4,17 @@ {capture} - {capture} is used to collect the output of the template into a + {capture} is used to collect the output of the template between the tags 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 + The captured content can be used in the + template from the 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. + supply a name attribute, then "default" will be used as in $smarty.capture.default. + You can nest capture commands. @@ -66,39 +68,33 @@ - capturing template content + {capture} with a the name attribute - - - {$smarty.capture.banner} - - - + {/if} ]]> - capturing content to a variable + {capture} into a template variable This example also demonstrates the {popup} function +Your ip is {$smarty.server.REMOTE_ADDR}. {/capture} - -help +help ]]> diff --git a/docs/en/designers/language-custom-functions/language-function-assign.xml b/docs/en/designers/language-custom-functions/language-function-assign.xml index 942e8709..a42eece4 100644 --- a/docs/en/designers/language-custom-functions/language-function-assign.xml +++ b/docs/en/designers/language-custom-functions/language-function-assign.xml @@ -5,7 +5,7 @@ {assign} is used for assigning template variables during the execution - of the template. + of a template. @@ -76,7 +76,7 @@ The value of $name is Bob. Accessing {assign} variables from a PHP script. - To access {assign} variables from php use + To access {assign} variables from the php script use get_template_vars(). However, the variables are only available after/during template execution as in the following example diff --git a/docs/en/designers/language-modifiers.xml b/docs/en/designers/language-modifiers.xml index 2d6db844..b5280689 100644 --- a/docs/en/designers/language-modifiers.xml +++ b/docs/en/designers/language-modifiers.xml @@ -45,6 +45,11 @@ {* php's shuffle on servers's ip *} {$smarty.server.SERVER_ADDR|shuffle} + +(* this will uppercase and truncate the whole array *} + ]]> diff --git a/docs/en/designers/language-modifiers/language-modifier-default.xml b/docs/en/designers/language-modifiers/language-modifier-default.xml index 10b35493..9eb3c1c2 100644 --- a/docs/en/designers/language-modifiers/language-modifier-default.xml +++ b/docs/en/designers/language-modifiers/language-modifier-default.xml @@ -7,6 +7,14 @@ is empty or unset, the given default value is printed instead. Default takes one argument. + + + + With error_reporting(E_ALL), undeclared variables will always throw an error within the template. This function + is useful for replacing null or zero length strings. + + + diff --git a/docs/en/designers/language-modifiers/language-modifier-escape.xml b/docs/en/designers/language-modifiers/language-modifier-escape.xml index 26a05ae4..3e767f3b 100644 --- a/docs/en/designers/language-modifiers/language-modifier-escape.xml +++ b/docs/en/designers/language-modifiers/language-modifier-escape.xml @@ -3,9 +3,8 @@ escape - This is used to html escape, url escape, escape single quotes on a - variable not already escaped, hex escape, hexentity or javascript escape. - By default, the variable is html + This is used to encode/escape and a variable to html url single quotes, hex escape, hexentity, javascript and mail escape. + By default its html escaped. @@ -69,12 +68,12 @@ $smarty->assign('EmailAddress','smarty@example.com'); *} -{$articleTitle|escape:"htmlall"} {* escapes ALL html entities *} -{$articleTitle|escape:"url"} -{$articleTitle|escape:"quotes"} +{$articleTitle|escape:'html'} {* escapes & " ' < > *} +{$articleTitle|escape:'htmlall'} {* escapes ALL html entities *} +{$articleTitle|escape:'url'} +{$articleTitle|escape:'quotes'} {$EmailAddress|escape:"hexentity"} -{$EmailAddress|escape:'mail'} +{$EmailAddress|escape:'mail'} {* this converts to email to text *} ]]> @@ -92,19 +91,28 @@ $smarty->assign('EmailAddress','smarty@example.com'); smarty [AT] example [DOT] com ]]> - Remember that native PHP functions can be used as modifiers so this will work + Note that native PHP functions can be used as modifiers so this will work click here ]]> - + + And this is very useful for emails but see also + {mailto} + + {$EmailAddress:escape'mail'} + ]]> + - See also Escaping Smarty Parsing + See also Escaping Smarty Parsing, + {mailto} and Obfuscating E-mail Addresses.