mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
WS and some fixes
This commit is contained in:
@@ -1,40 +1,40 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="chapter.debugging.console">
|
||||
<title>Debugging Console</title>
|
||||
<para>
|
||||
There is a debugging console included with Smarty. The console informs you
|
||||
of all the included templates, assigned variables and config file variables
|
||||
for the current invocation of the template. A template named "debug.tpl" is
|
||||
included with the distribution of Smarty which controls the formatting of
|
||||
the console. Set $debugging to true in Smarty, and if needed set $debug_tpl
|
||||
to the template resource path for debug.tpl (this is in SMARTY_DIR by
|
||||
default.) When you load the page, a javascript console window should pop up
|
||||
and give you the names of all the included templates and assigned variables
|
||||
for the current page. To see the available variables for a particular
|
||||
templates, see the <link linkend="language.function.debug">{debug}</link>
|
||||
template function. To disable the debugging console, set $debugging to
|
||||
false. You can also temporarily turn on the debugging console by putting
|
||||
SMARTY_DEBUG in the URL if you enable this option with <link
|
||||
linkend="variable.debugging.ctrl">$debugging_ctrl</link>.
|
||||
</para>
|
||||
<note>
|
||||
<title>Technical Note</title>
|
||||
<para>
|
||||
The debugging console does not work when you use the fetch()
|
||||
API, only when using display(). It is a set of javascript statements added
|
||||
to the very bottom of the generated template. If you do not like javascript,
|
||||
you can edit the debug.tpl template to format the output however you like.
|
||||
Debug data is not cached and debug.tpl info is not included in the output of
|
||||
the debug console.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
The load times of each template and config file are in seconds, or
|
||||
fractions thereof.
|
||||
</para>
|
||||
</note>
|
||||
<chapter id="chapter.debugging.console">
|
||||
<title>Debugging Console</title>
|
||||
<para>
|
||||
There is a debugging console included with Smarty. The console informs you
|
||||
of all the included templates, assigned variables and config file variables
|
||||
for the current invocation of the template. A template named "debug.tpl" is
|
||||
included with the distribution of Smarty which controls the formatting of
|
||||
the console. Set $debugging to true in Smarty, and if needed set $debug_tpl
|
||||
to the template resource path for debug.tpl (this is in SMARTY_DIR by
|
||||
default.) When you load the page, a javascript console window should pop up
|
||||
and give you the names of all the included templates and assigned variables
|
||||
for the current page. To see the available variables for a particular
|
||||
templates, see the <link linkend="language.function.debug">{debug}</link>
|
||||
template function. To disable the debugging console, set $debugging to
|
||||
false. You can also temporarily turn on the debugging console by putting
|
||||
SMARTY_DEBUG in the URL if you enable this option with <link
|
||||
linkend="variable.debugging.ctrl">$debugging_ctrl</link>.
|
||||
</para>
|
||||
<note>
|
||||
<title>Technical Note</title>
|
||||
<para>
|
||||
The debugging console does not work when you use the fetch()
|
||||
API, only when using display(). It is a set of javascript statements added
|
||||
to the very bottom of the generated template. If you do not like javascript,
|
||||
you can edit the debug.tpl template to format the output however you like.
|
||||
Debug data is not cached and debug.tpl info is not included in the output of
|
||||
the debug console.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<para>
|
||||
The load times of each template and config file are in seconds, or
|
||||
fractions thereof.
|
||||
</para>
|
||||
</note>
|
||||
</chapter>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -1,18 +1,19 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="config.files">
|
||||
<title>Config Files</title>
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
<example>
|
||||
<title>Example of config file syntax</title>
|
||||
<programlisting>
|
||||
<chapter id="config.files">
|
||||
<title>Config Files</title>
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
<example>
|
||||
<title>Example of config file syntax</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
# global variables
|
||||
pageTitle = "Main Menu"
|
||||
bodyBgColor = #000000
|
||||
@@ -26,8 +27,8 @@ pageTitle = "Customer Info"
|
||||
pageTitle = "Login"
|
||||
focus = "username"
|
||||
Intro = """This is a value that spans more
|
||||
than one line. you must enclose
|
||||
it in triple quotes."""
|
||||
than one line. you must enclose
|
||||
it in triple quotes."""
|
||||
|
||||
# hidden section
|
||||
[.Database]
|
||||
@@ -35,40 +36,41 @@ host=my.domain.com
|
||||
db=ADDRESSBOOK
|
||||
user=php-user
|
||||
pass=foobar
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Values of 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 <literal>#</literal>
|
||||
(hash) at the beginning of the line.
|
||||
</para>
|
||||
<para>
|
||||
This config file example has two sections. Section names are enclosed in
|
||||
brackets []. Section names can be arbitrary strings not containing
|
||||
<literal>[</literal> or <literal>]</literal> 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.
|
||||
</para>
|
||||
<para>
|
||||
Config files are loaded into templates with the built-in function
|
||||
<command>config_load</command>.
|
||||
</para>
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
</chapter>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Values of 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 <literal>#</literal>
|
||||
(hash) at the beginning of the line.
|
||||
</para>
|
||||
<para>
|
||||
This config file example has two sections. Section names are enclosed in
|
||||
brackets []. Section names can be arbitrary strings not containing
|
||||
<literal>[</literal> or <literal>]</literal> 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.
|
||||
</para>
|
||||
<para>
|
||||
Config files are loaded into templates with the built-in function
|
||||
<command>config_load</command>.
|
||||
</para>
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
</chapter>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
@@ -1,30 +1,28 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="language.basic.syntax">
|
||||
<title>Basic Syntax</title>
|
||||
<para>
|
||||
All Smarty template tags are enclosed within delimiters. By
|
||||
default, these delimiters are <literal>{</literal> and
|
||||
<literal>}</literal>, but they can be changed.
|
||||
</para>
|
||||
<para>
|
||||
For these examples, we will assume that you are using the default
|
||||
delimiters. In Smarty, all content outside of delimiters is displayed as
|
||||
static content, or unchanged. When Smarty encounters template tags, it
|
||||
attempts to interpret them, and displays the appropriate output in their
|
||||
place.
|
||||
</para>
|
||||
<chapter id="language.basic.syntax">
|
||||
<title>Basic Syntax</title>
|
||||
<para>
|
||||
All Smarty template tags are enclosed within delimiters. By
|
||||
default, these delimiters are <literal>{</literal> and
|
||||
<literal>}</literal>, but they can be changed.
|
||||
</para>
|
||||
<para>
|
||||
For these examples, we will assume that you are using the default
|
||||
delimiters. In Smarty, all content outside of delimiters is displayed as
|
||||
static content, or unchanged. When Smarty encounters template tags, it
|
||||
attempts to interpret them, and displays the appropriate output in their
|
||||
place.
|
||||
</para>
|
||||
|
||||
&designers.language-basic-syntax.language-syntax-comments;
|
||||
|
||||
&designers.language-basic-syntax.language-syntax-functions;
|
||||
|
||||
&designers.language-basic-syntax.language-syntax-attributes;
|
||||
&designers.language-basic-syntax.language-syntax-quotes;
|
||||
&designers.language-basic-syntax.language-math;
|
||||
|
||||
&designers.language-basic-syntax.language-escaping;
|
||||
</chapter>
|
||||
&designers.language-basic-syntax.language-syntax-comments;
|
||||
&designers.language-basic-syntax.language-syntax-functions;
|
||||
&designers.language-basic-syntax.language-syntax-attributes;
|
||||
&designers.language-basic-syntax.language-syntax-quotes;
|
||||
&designers.language-basic-syntax.language-math;
|
||||
&designers.language-basic-syntax.language-escaping;
|
||||
|
||||
</chapter>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
|
@@ -1,24 +1,26 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="language.builtin.functions">
|
||||
<title>Built-in Functions</title>
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
&designers.language-builtin-functions.language-function-capture;
|
||||
&designers.language-builtin-functions.language-function-config-load;
|
||||
&designers.language-builtin-functions.language-function-foreach;
|
||||
&designers.language-builtin-functions.language-function-include;
|
||||
&designers.language-builtin-functions.language-function-include-php;
|
||||
&designers.language-builtin-functions.language-function-insert;
|
||||
&designers.language-builtin-functions.language-function-if;
|
||||
&designers.language-builtin-functions.language-function-ldelim;
|
||||
&designers.language-builtin-functions.language-function-literal;
|
||||
&designers.language-builtin-functions.language-function-php;
|
||||
&designers.language-builtin-functions.language-function-section;
|
||||
&designers.language-builtin-functions.language-function-strip;
|
||||
<chapter id="language.builtin.functions">
|
||||
<title>Built-in Functions</title>
|
||||
<para>
|
||||
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.
|
||||
</para>
|
||||
|
||||
&designers.language-builtin-functions.language-function-capture;
|
||||
&designers.language-builtin-functions.language-function-config-load;
|
||||
&designers.language-builtin-functions.language-function-foreach;
|
||||
&designers.language-builtin-functions.language-function-include;
|
||||
&designers.language-builtin-functions.language-function-include-php;
|
||||
&designers.language-builtin-functions.language-function-insert;
|
||||
&designers.language-builtin-functions.language-function-if;
|
||||
&designers.language-builtin-functions.language-function-ldelim;
|
||||
&designers.language-builtin-functions.language-function-literal;
|
||||
&designers.language-builtin-functions.language-function-php;
|
||||
&designers.language-builtin-functions.language-function-section;
|
||||
&designers.language-builtin-functions.language-function-strip;
|
||||
|
||||
</chapter>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
@@ -39,4 +41,4 @@ End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
-->
|
||||
|
@@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="language.combining.modifiers">
|
||||
<title>Combining Modifiers</title>
|
||||
<para>
|
||||
You can apply any number of modifiers to a variable. They will be
|
||||
applied in the order they are combined, from left to right. They must
|
||||
be separated with a <literal>|</literal> (pipe) character.
|
||||
</para>
|
||||
<example>
|
||||
<title>combining modifiers</title>
|
||||
<programlisting role="php">
|
||||
<chapter id="language.combining.modifiers">
|
||||
<title>Combining Modifiers</title>
|
||||
<para>
|
||||
You can apply any number of modifiers to a variable. They will be
|
||||
applied in the order they are combined, from left to right. They must
|
||||
be separated with a <literal>|</literal> (pipe) character.
|
||||
</para>
|
||||
<example>
|
||||
<title>combining modifiers</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
index.php:
|
||||
<?php
|
||||
@@ -26,11 +26,11 @@ index.tpl:
|
||||
{$articleTitle|lower|truncate:30|spacify}
|
||||
{$articleTitle|lower|spacify|truncate:30:". . ."}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The above example will output:
|
||||
</para>
|
||||
<screen>
|
||||
</programlisting>
|
||||
<para>
|
||||
The above example will output:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Smokers are Productive, but Death Cuts Efficiency.
|
||||
S M O K E R S A R E P R O D U C T I V E , B U T D E A T H C U T S E F F I C I E N C Y .
|
||||
@@ -38,9 +38,9 @@ s m o k e r s a r e p r o d u c t i v e , b u t d e a t h c u t s...
|
||||
s m o k e r s a r e p r o d u c t i v e , b u t . . .
|
||||
s m o k e r s a r e p. . .
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
</chapter>
|
||||
</screen>
|
||||
</example>
|
||||
</chapter>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
@@ -1,29 +1,31 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="language.custom.functions">
|
||||
<title>Custom Functions</title>
|
||||
<para>
|
||||
Smarty comes with several custom functions that you can
|
||||
use in the templates.
|
||||
</para>
|
||||
&designers.language-custom-functions.language-function-assign;
|
||||
&designers.language-custom-functions.language-function-counter;
|
||||
&designers.language-custom-functions.language-function-cycle;
|
||||
&designers.language-custom-functions.language-function-debug;
|
||||
&designers.language-custom-functions.language-function-eval;
|
||||
&designers.language-custom-functions.language-function-fetch;
|
||||
&designers.language-custom-functions.language-function-html-checkboxes;
|
||||
&designers.language-custom-functions.language-function-html-image;
|
||||
&designers.language-custom-functions.language-function-html-options;
|
||||
&designers.language-custom-functions.language-function-html-radios;
|
||||
&designers.language-custom-functions.language-function-html-select-date;
|
||||
&designers.language-custom-functions.language-function-html-select-time;
|
||||
&designers.language-custom-functions.language-function-html-table;
|
||||
&designers.language-custom-functions.language-function-math;
|
||||
&designers.language-custom-functions.language-function-mailto;
|
||||
&designers.language-custom-functions.language-function-popup-init;
|
||||
&designers.language-custom-functions.language-function-popup;
|
||||
&designers.language-custom-functions.language-function-textformat;
|
||||
<chapter id="language.custom.functions">
|
||||
<title>Custom Functions</title>
|
||||
<para>
|
||||
Smarty comes with several custom functions that you can
|
||||
use in the templates.
|
||||
</para>
|
||||
|
||||
&designers.language-custom-functions.language-function-assign;
|
||||
&designers.language-custom-functions.language-function-counter;
|
||||
&designers.language-custom-functions.language-function-cycle;
|
||||
&designers.language-custom-functions.language-function-debug;
|
||||
&designers.language-custom-functions.language-function-eval;
|
||||
&designers.language-custom-functions.language-function-fetch;
|
||||
&designers.language-custom-functions.language-function-html-checkboxes;
|
||||
&designers.language-custom-functions.language-function-html-image;
|
||||
&designers.language-custom-functions.language-function-html-options;
|
||||
&designers.language-custom-functions.language-function-html-radios;
|
||||
&designers.language-custom-functions.language-function-html-select-date;
|
||||
&designers.language-custom-functions.language-function-html-select-time;
|
||||
&designers.language-custom-functions.language-function-html-table;
|
||||
&designers.language-custom-functions.language-function-math;
|
||||
&designers.language-custom-functions.language-function-mailto;
|
||||
&designers.language-custom-functions.language-function-popup-init;
|
||||
&designers.language-custom-functions.language-function-popup;
|
||||
&designers.language-custom-functions.language-function-textformat;
|
||||
|
||||
</chapter>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
@@ -56,28 +56,27 @@ Topic: {$topic|truncate:40:"..."}
|
||||
$security_settings['MODIFIER_FUNCS']</link>-array.
|
||||
</para>
|
||||
|
||||
&designers.language-modifiers.language-modifier-capitalize;
|
||||
&designers.language-modifiers.language-modifier-count-characters;
|
||||
&designers.language-modifiers.language-modifier-cat;
|
||||
&designers.language-modifiers.language-modifier-count-paragraphs;
|
||||
&designers.language-modifiers.language-modifier-count-sentences;
|
||||
&designers.language-modifiers.language-modifier-count-words;
|
||||
&designers.language-modifiers.language-modifier-date-format;
|
||||
|
||||
&designers.language-modifiers.language-modifier-default;
|
||||
&designers.language-modifiers.language-modifier-escape;
|
||||
&designers.language-modifiers.language-modifier-indent;
|
||||
&designers.language-modifiers.language-modifier-lower;
|
||||
&designers.language-modifiers.language-modifier-nl2br;
|
||||
&designers.language-modifiers.language-modifier-regex-replace;
|
||||
&designers.language-modifiers.language-modifier-replace;
|
||||
&designers.language-modifiers.language-modifier-spacify;
|
||||
&designers.language-modifiers.language-modifier-string-format;
|
||||
&designers.language-modifiers.language-modifier-strip;
|
||||
&designers.language-modifiers.language-modifier-strip-tags;
|
||||
&designers.language-modifiers.language-modifier-truncate;
|
||||
&designers.language-modifiers.language-modifier-upper;
|
||||
&designers.language-modifiers.language-modifier-wordwrap;
|
||||
&designers.language-modifiers.language-modifier-capitalize;
|
||||
&designers.language-modifiers.language-modifier-count-characters;
|
||||
&designers.language-modifiers.language-modifier-cat;
|
||||
&designers.language-modifiers.language-modifier-count-paragraphs;
|
||||
&designers.language-modifiers.language-modifier-count-sentences;
|
||||
&designers.language-modifiers.language-modifier-count-words;
|
||||
&designers.language-modifiers.language-modifier-date-format;
|
||||
&designers.language-modifiers.language-modifier-default;
|
||||
&designers.language-modifiers.language-modifier-escape;
|
||||
&designers.language-modifiers.language-modifier-indent;
|
||||
&designers.language-modifiers.language-modifier-lower;
|
||||
&designers.language-modifiers.language-modifier-nl2br;
|
||||
&designers.language-modifiers.language-modifier-regex-replace;
|
||||
&designers.language-modifiers.language-modifier-replace;
|
||||
&designers.language-modifiers.language-modifier-spacify;
|
||||
&designers.language-modifiers.language-modifier-string-format;
|
||||
&designers.language-modifiers.language-modifier-strip;
|
||||
&designers.language-modifiers.language-modifier-strip-tags;
|
||||
&designers.language-modifiers.language-modifier-truncate;
|
||||
&designers.language-modifiers.language-modifier-upper;
|
||||
&designers.language-modifiers.language-modifier-wordwrap;
|
||||
|
||||
</chapter>
|
||||
|
||||
|
@@ -1,18 +1,17 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="language.variables">
|
||||
<title>Variables</title>
|
||||
<para>
|
||||
Smarty has several different types of variables. The type of the variable
|
||||
depends on what symbol it is prefixed with (or enclosed within).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Variables in Smarty can be either displayed directly or used as arguments
|
||||
for function attributes and modifiers, inside conditional expressions,
|
||||
etc. To print a variable, simply enclose it in the delimiters so that it
|
||||
is the only thing contained between them. Examples:
|
||||
<programlisting>
|
||||
<chapter id="language.variables">
|
||||
<title>Variables</title>
|
||||
<para>
|
||||
Smarty has several different types of variables. The type of the variable
|
||||
depends on what symbol it is prefixed with (or enclosed within).
|
||||
</para>
|
||||
<para>
|
||||
Variables in Smarty can be either displayed directly or used as arguments
|
||||
for function attributes and modifiers, inside conditional expressions,
|
||||
etc. To print a variable, simply enclose it in the delimiters so that it
|
||||
is the only thing contained between them. Examples:
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$Name}
|
||||
|
||||
@@ -20,14 +19,13 @@
|
||||
|
||||
<body bgcolor="{#bgcolor#}">
|
||||
]]>
|
||||
</programlisting>
|
||||
</para>
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
&designers.language-variables.language-assigned-variables;
|
||||
&designers.language-variables.language-assigned-variables;
|
||||
&designers.language-variables.language-config-variables;
|
||||
&designers.language-variables.language-variables-smarty;
|
||||
|
||||
&designers.language-variables.language-config-variables;
|
||||
|
||||
&designers.language-variables.language-variables-smarty;
|
||||
</chapter>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
Reference in New Issue
Block a user