WS and some fixes

This commit is contained in:
didou
2004-04-18 17:30:04 +00:00
parent 421af5ed7c
commit a9bc3c91a0
8 changed files with 212 additions and 211 deletions

View File

@@ -1,40 +1,40 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<chapter id="chapter.debugging.console"> <chapter id="chapter.debugging.console">
<title>Debugging Console</title> <title>Debugging Console</title>
<para> <para>
There is a debugging console included with Smarty. The console informs you There is a debugging console included with Smarty. The console informs you
of all the included templates, assigned variables and config file variables of all the included templates, assigned variables and config file variables
for the current invocation of the template. A template named "debug.tpl" is for the current invocation of the template. A template named "debug.tpl" is
included with the distribution of Smarty which controls the formatting of 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 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 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 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 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 for the current page. To see the available variables for a particular
templates, see the <link linkend="language.function.debug">{debug}</link> templates, see the <link linkend="language.function.debug">{debug}</link>
template function. To disable the debugging console, set $debugging to template function. To disable the debugging console, set $debugging to
false. You can also temporarily turn on the debugging console by putting false. You can also temporarily turn on the debugging console by putting
SMARTY_DEBUG in the URL if you enable this option with <link SMARTY_DEBUG in the URL if you enable this option with <link
linkend="variable.debugging.ctrl">$debugging_ctrl</link>. linkend="variable.debugging.ctrl">$debugging_ctrl</link>.
</para> </para>
<note> <note>
<title>Technical Note</title> <title>Technical Note</title>
<para> <para>
The debugging console does not work when you use the fetch() The debugging console does not work when you use the fetch()
API, only when using display(). It is a set of javascript statements added 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, 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. 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 Debug data is not cached and debug.tpl info is not included in the output of
the debug console. the debug console.
</para> </para>
</note> </note>
<note> <note>
<para> <para>
The load times of each template and config file are in seconds, or The load times of each template and config file are in seconds, or
fractions thereof. fractions thereof.
</para> </para>
</note> </note>
</chapter> </chapter>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -1,18 +1,19 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<chapter id="config.files"> <chapter id="config.files">
<title>Config Files</title> <title>Config Files</title>
<para> <para>
Config files are handy for designers to manage global template Config files are handy for designers to manage global template
variables from one file. One example is template colors. Normally if variables from one file. One example is template colors. Normally if
you wanted to change the color scheme of an application, you would have 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 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 a config file, the colors can be kept in one place, and only one file
needs to be updated. needs to be updated.
</para> </para>
<example> <example>
<title>Example of config file syntax</title> <title>Example of config file syntax</title>
<programlisting> <programlisting>
<![CDATA[
# global variables # global variables
pageTitle = "Main Menu" pageTitle = "Main Menu"
bodyBgColor = #000000 bodyBgColor = #000000
@@ -26,8 +27,8 @@ pageTitle = "Customer Info"
pageTitle = "Login" pageTitle = "Login"
focus = "username" focus = "username"
Intro = """This is a value that spans more Intro = """This is a value that spans more
than one line. you must enclose than one line. you must enclose
it in triple quotes.""" it in triple quotes."""
# hidden section # hidden section
[.Database] [.Database]
@@ -35,40 +36,41 @@ host=my.domain.com
db=ADDRESSBOOK db=ADDRESSBOOK
user=php-user user=php-user
pass=foobar pass=foobar
</programlisting> ]]>
</example> </programlisting>
<para> </example>
Values of config file variables can be in quotes, but not necessary. <para>
You can use either single or double quotes. If you have a value that Values of config file variables can be in quotes, but not necessary.
spans more than one line, enclose the entire value with triple quotes You can use either single or double quotes. If you have a value that
("""). You can put comments into config files by any syntax that is not spans more than one line, enclose the entire value with triple quotes
a valid config file syntax. We recommend using a <literal>#</literal> ("""). You can put comments into config files by any syntax that is not
(hash) at the beginning of the line. a valid config file syntax. We recommend using a <literal>#</literal>
</para> (hash) at the beginning of the line.
<para> </para>
This config file example has two sections. Section names are enclosed in <para>
brackets []. Section names can be arbitrary strings not containing This config file example has two sections. Section names are enclosed in
<literal>[</literal> or <literal>]</literal> symbols. The four variables brackets []. Section names can be arbitrary strings not containing
at the top are global variables, or variables not within a section. <literal>[</literal> or <literal>]</literal> symbols. The four variables
These variables are always loaded from the config file. If a particular at the top are global variables, or variables not within a section.
section is loaded, then the global variables and the variables from that These variables are always loaded from the config file. If a particular
section are also loaded. If a variable exists both as a global and in a section is loaded, then the global variables and the variables from that
section, the section variable is used. If you name two variables the section are also loaded. If a variable exists both as a global and in a
same within a section, the last one will be used. section, the section variable is used. If you name two variables the
</para> same within a section, the last one will be used.
<para> </para>
Config files are loaded into templates with the built-in function <para>
<command>config_load</command>. Config files are loaded into templates with the built-in function
</para> <command>config_load</command>.
<para> </para>
You can hide variables or entire sections by prepending the variable <para>
name or section name with a period. This is useful if your application You can hide variables or entire sections by prepending the variable
reads the config files and gets sensitive data from them that the name or section name with a period. This is useful if your application
template engine does not need. If you have third parties doing template reads the config files and gets sensitive data from them that the
editing, you can be certain that they cannot read sensitive data from template engine does not need. If you have third parties doing template
the config file by loading it into the template. editing, you can be certain that they cannot read sensitive data from
</para> the config file by loading it into the template.
</chapter> </para>
</chapter>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -1,30 +1,28 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<chapter id="language.basic.syntax"> <chapter id="language.basic.syntax">
<title>Basic Syntax</title> <title>Basic Syntax</title>
<para> <para>
All Smarty template tags are enclosed within delimiters. By All Smarty template tags are enclosed within delimiters. By
default, these delimiters are <literal>{</literal> and default, these delimiters are <literal>{</literal> and
<literal>}</literal>, but they can be changed. <literal>}</literal>, but they can be changed.
</para> </para>
<para> <para>
For these examples, we will assume that you are using the default For these examples, we will assume that you are using the default
delimiters. In Smarty, all content outside of delimiters is displayed as delimiters. In Smarty, all content outside of delimiters is displayed as
static content, or unchanged. When Smarty encounters template tags, it static content, or unchanged. When Smarty encounters template tags, it
attempts to interpret them, and displays the appropriate output in their attempts to interpret them, and displays the appropriate output in their
place. place.
</para> </para>
&designers.language-basic-syntax.language-syntax-comments; &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;
&designers.language-basic-syntax.language-syntax-functions; </chapter>
&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 <!-- Keep this comment at the end of the file
Local variables: Local variables:
mode: sgml mode: sgml

View File

@@ -1,24 +1,26 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<chapter id="language.builtin.functions"> <chapter id="language.builtin.functions">
<title>Built-in Functions</title> <title>Built-in Functions</title>
<para> <para>
Smarty comes with several built-in functions. Built-in functions Smarty comes with several built-in functions. Built-in functions
are integral to the template language. You cannot create custom are integral to the template language. You cannot create custom
functions with the same names, nor can you modify built-in functions. functions with the same names, nor can you modify built-in functions.
</para> </para>
&designers.language-builtin-functions.language-function-capture;
&designers.language-builtin-functions.language-function-config-load; &designers.language-builtin-functions.language-function-capture;
&designers.language-builtin-functions.language-function-foreach; &designers.language-builtin-functions.language-function-config-load;
&designers.language-builtin-functions.language-function-include; &designers.language-builtin-functions.language-function-foreach;
&designers.language-builtin-functions.language-function-include-php; &designers.language-builtin-functions.language-function-include;
&designers.language-builtin-functions.language-function-insert; &designers.language-builtin-functions.language-function-include-php;
&designers.language-builtin-functions.language-function-if; &designers.language-builtin-functions.language-function-insert;
&designers.language-builtin-functions.language-function-ldelim; &designers.language-builtin-functions.language-function-if;
&designers.language-builtin-functions.language-function-literal; &designers.language-builtin-functions.language-function-ldelim;
&designers.language-builtin-functions.language-function-php; &designers.language-builtin-functions.language-function-literal;
&designers.language-builtin-functions.language-function-section; &designers.language-builtin-functions.language-function-php;
&designers.language-builtin-functions.language-function-strip; &designers.language-builtin-functions.language-function-section;
&designers.language-builtin-functions.language-function-strip;
</chapter> </chapter>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<chapter id="language.combining.modifiers"> <chapter id="language.combining.modifiers">
<title>Combining Modifiers</title> <title>Combining Modifiers</title>
<para> <para>
You can apply any number of modifiers to a variable. They will be 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 applied in the order they are combined, from left to right. They must
be separated with a <literal>|</literal> (pipe) character. be separated with a <literal>|</literal> (pipe) character.
</para> </para>
<example> <example>
<title>combining modifiers</title> <title>combining modifiers</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
index.php: index.php:
<?php <?php
@@ -26,11 +26,11 @@ index.tpl:
{$articleTitle|lower|truncate:30|spacify} {$articleTitle|lower|truncate:30|spacify}
{$articleTitle|lower|spacify|truncate:30:". . ."} {$articleTitle|lower|spacify|truncate:30:". . ."}
]]> ]]>
</programlisting> </programlisting>
<para> <para>
The above example will output: The above example will output:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
Smokers are Productive, but Death Cuts Efficiency. 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 . 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 r o d u c t i v e , b u t . . .
s m o k e r s a r e p. . . s m o k e r s a r e p. . .
]]> ]]>
</screen> </screen>
</example> </example>
</chapter> </chapter>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -1,29 +1,31 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<chapter id="language.custom.functions"> <chapter id="language.custom.functions">
<title>Custom Functions</title> <title>Custom Functions</title>
<para> <para>
Smarty comes with several custom functions that you can Smarty comes with several custom functions that you can
use in the templates. use in the templates.
</para> </para>
&designers.language-custom-functions.language-function-assign;
&designers.language-custom-functions.language-function-counter; &designers.language-custom-functions.language-function-assign;
&designers.language-custom-functions.language-function-cycle; &designers.language-custom-functions.language-function-counter;
&designers.language-custom-functions.language-function-debug; &designers.language-custom-functions.language-function-cycle;
&designers.language-custom-functions.language-function-eval; &designers.language-custom-functions.language-function-debug;
&designers.language-custom-functions.language-function-fetch; &designers.language-custom-functions.language-function-eval;
&designers.language-custom-functions.language-function-html-checkboxes; &designers.language-custom-functions.language-function-fetch;
&designers.language-custom-functions.language-function-html-image; &designers.language-custom-functions.language-function-html-checkboxes;
&designers.language-custom-functions.language-function-html-options; &designers.language-custom-functions.language-function-html-image;
&designers.language-custom-functions.language-function-html-radios; &designers.language-custom-functions.language-function-html-options;
&designers.language-custom-functions.language-function-html-select-date; &designers.language-custom-functions.language-function-html-radios;
&designers.language-custom-functions.language-function-html-select-time; &designers.language-custom-functions.language-function-html-select-date;
&designers.language-custom-functions.language-function-html-table; &designers.language-custom-functions.language-function-html-select-time;
&designers.language-custom-functions.language-function-math; &designers.language-custom-functions.language-function-html-table;
&designers.language-custom-functions.language-function-mailto; &designers.language-custom-functions.language-function-math;
&designers.language-custom-functions.language-function-popup-init; &designers.language-custom-functions.language-function-mailto;
&designers.language-custom-functions.language-function-popup; &designers.language-custom-functions.language-function-popup-init;
&designers.language-custom-functions.language-function-textformat; &designers.language-custom-functions.language-function-popup;
&designers.language-custom-functions.language-function-textformat;
</chapter> </chapter>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -56,28 +56,27 @@ Topic: {$topic|truncate:40:"..."}
$security_settings['MODIFIER_FUNCS']</link>-array. $security_settings['MODIFIER_FUNCS']</link>-array.
</para> </para>
&designers.language-modifiers.language-modifier-capitalize; &designers.language-modifiers.language-modifier-capitalize;
&designers.language-modifiers.language-modifier-count-characters; &designers.language-modifiers.language-modifier-count-characters;
&designers.language-modifiers.language-modifier-cat; &designers.language-modifiers.language-modifier-cat;
&designers.language-modifiers.language-modifier-count-paragraphs; &designers.language-modifiers.language-modifier-count-paragraphs;
&designers.language-modifiers.language-modifier-count-sentences; &designers.language-modifiers.language-modifier-count-sentences;
&designers.language-modifiers.language-modifier-count-words; &designers.language-modifiers.language-modifier-count-words;
&designers.language-modifiers.language-modifier-date-format; &designers.language-modifiers.language-modifier-date-format;
&designers.language-modifiers.language-modifier-default;
&designers.language-modifiers.language-modifier-default; &designers.language-modifiers.language-modifier-escape;
&designers.language-modifiers.language-modifier-escape; &designers.language-modifiers.language-modifier-indent;
&designers.language-modifiers.language-modifier-indent; &designers.language-modifiers.language-modifier-lower;
&designers.language-modifiers.language-modifier-lower; &designers.language-modifiers.language-modifier-nl2br;
&designers.language-modifiers.language-modifier-nl2br; &designers.language-modifiers.language-modifier-regex-replace;
&designers.language-modifiers.language-modifier-regex-replace; &designers.language-modifiers.language-modifier-replace;
&designers.language-modifiers.language-modifier-replace; &designers.language-modifiers.language-modifier-spacify;
&designers.language-modifiers.language-modifier-spacify; &designers.language-modifiers.language-modifier-string-format;
&designers.language-modifiers.language-modifier-string-format; &designers.language-modifiers.language-modifier-strip;
&designers.language-modifiers.language-modifier-strip; &designers.language-modifiers.language-modifier-strip-tags;
&designers.language-modifiers.language-modifier-strip-tags; &designers.language-modifiers.language-modifier-truncate;
&designers.language-modifiers.language-modifier-truncate; &designers.language-modifiers.language-modifier-upper;
&designers.language-modifiers.language-modifier-upper; &designers.language-modifiers.language-modifier-wordwrap;
&designers.language-modifiers.language-modifier-wordwrap;
</chapter> </chapter>

View File

@@ -1,18 +1,17 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<chapter id="language.variables"> <chapter id="language.variables">
<title>Variables</title> <title>Variables</title>
<para> <para>
Smarty has several different types of variables. The type of the variable Smarty has several different types of variables. The type of the variable
depends on what symbol it is prefixed with (or enclosed within). depends on what symbol it is prefixed with (or enclosed within).
</para> </para>
<para>
<para> Variables in Smarty can be either displayed directly or used as arguments
Variables in Smarty can be either displayed directly or used as arguments for function attributes and modifiers, inside conditional expressions,
for function attributes and modifiers, inside conditional expressions, etc. To print a variable, simply enclose it in the delimiters so that it
etc. To print a variable, simply enclose it in the delimiters so that it is the only thing contained between them. Examples:
is the only thing contained between them. Examples: <programlisting>
<programlisting>
<![CDATA[ <![CDATA[
{$Name} {$Name}
@@ -20,14 +19,13 @@
<body bgcolor="{#bgcolor#}"> <body bgcolor="{#bgcolor#}">
]]> ]]>
</programlisting> </programlisting>
</para> </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> </chapter>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file