another patch by Peter. some WS.

This commit is contained in:
nlopess
2005-05-21 12:41:15 +00:00
parent 918ce294ad
commit 4b80984d6a
24 changed files with 289 additions and 186 deletions

View File

@@ -9,7 +9,8 @@
<para>
There may be times when you want to print a default value for an empty
variable instead of printing nothing, such as printing "&amp;nbsp;" so that
table backgrounds work properly. Many would use an <link linkend="language.function.if">{if}</link> statement to
table backgrounds work properly. Many would use an
<link linkend="language.function.if">{if}</link> statement to
handle this, but there is a shorthand way with Smarty, using the
<emphasis>default</emphasis> variable modifier.
</para>
@@ -32,7 +33,10 @@
]]>
</programlisting>
</example>
<para>See also <link linkend="language.modifier.default">default</link> and <link linkend="tips.default.var.handling">Default Variable Handling</link></para>
<para>
See also <link linkend="language.modifier.default">default</link>
and <link linkend="tips.default.var.handling">Default Variable Handling</link>.
</para>
</sect1>
<sect1 id="tips.default.var.handling">
@@ -55,8 +59,12 @@
]]>
</programlisting>
</example>
<para>See also <link linkend="language.modifier.default">default</link> and <link linkend="tips.blank.var.handling">Blank Variable Handling</link></para>
<para>
See also <link linkend="language.modifier.default">default</link> and
<link linkend="tips.blank.var.handling">Blank Variable Handling</link>.
</para>
</sect1>
<sect1 id="tips.passing.vars">
<title>Passing variable title to header template</title>
<para>
@@ -125,7 +133,8 @@ footer.tpl
<note>
<para>
As of Smarty 1.4.0, you can pass dates to Smarty as unix
timestamps, mysql timestamps, or any date parsable by <ulink url="&url.php-manual;strtotime">strtotime()</ulink>.
timestamps, mysql timestamps, or any date parsable by
<ulink url="&url.php-manual;strtotime">strtotime()</ulink>.
</para>
</note>
<example>
@@ -165,7 +174,8 @@ Jan 4, 2001
</programlisting>
</example>
<para>
When using <link linkend="language.function.html.select.date">{html_select_date}</link> in a template, The programmer will most
When using <link linkend="language.function.html.select.date">{html_select_date}</link>
in a template, The programmer will most
likely want to convert the output from the form back into timestamp
format. Here is a function to help you with that.
</para>
@@ -269,7 +279,8 @@ function insert_header($params)
Traditionally, programming templates into your applications goes as
follows: First, you accumulate your variables within your PHP
application, (maybe with database queries.) Then, you instantiate your
Smarty object, <link linkend="api.assign">assign</link> the variables and <link linkend="api.display">display</link> the template. So lets
Smarty object, <link linkend="api.assign">assign</link> the variables and
<link linkend="api.display">display</link> the template. So lets
say for example we have a stock ticker on our template. We would
collect the stock data in our application, then assign these variables
in the template and display it. Now wouldn't it be nice if you could
@@ -317,8 +328,13 @@ Stock Name: {$ticker.name} Stock Price: {$ticker.price}
]]>
</programlisting>
</example>
<para>See also <link linkend="language.function.include.php">{include_php}</link>, <link linkend="language.function.include">{include}</link> and <link linkend="language.function.php">{php}</link></para>
<para>
See also <link linkend="language.function.include.php">{include_php}</link>,
<link linkend="language.function.include">{include}</link> and
<link linkend="language.function.php">{php}</link>.
</para>
</sect1>
<sect1 id="tips.obfuscating.email">
<title>Obfuscating E-mail Addresses</title>
<para>
@@ -346,9 +362,12 @@ Send inquiries to
e-mail collector to decode these values, but not likely.
</para>
</note>
<para>See also <link linkend="language.modifier.escape">escape</link></para>
<para>
See also <link linkend="language.modifier.escape">escape</link>.
</para>
</sect1>
</chapter>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -28,15 +28,22 @@
</programlisting>
</example>
<para>
Both built-in functions and custom functions have the same syntax in
the templates. Built-in functions are the inner workings of Smarty,
such as <link linkend="language.function.if"><command>if</command></link>, <link linkend="language.function.section"><command>section</command></link> and
<link linkend="language.function.strip"><command>strip</command></link>. They cannot be modified. Custom functions are
additional functions implemented via plugins. They can be modified to
your liking, or you can add new ones. <link linkend="language.function.html.options"><command>html_options</command></link> and
<link linkend="language.function.html.select.date"><command>html_select_date</command></link> are examples of custom functions.
Both <link linkend="language.builtin.functions">built-in functions</link>
and <link linkend="language.custom.functions">custom functions</link>
have the same syntax in the templates. Built-in functions are the
inner workings of Smarty, such as
<link linkend="language.function.if"><command>if</command></link>,
<link linkend="language.function.section"><command>section</command></link> and
<link linkend="language.function.strip"><command>strip</command></link>.
They cannot be modified. Custom functions are
additional functions implemented via <link linkend="plugins">plugins</link>.
They can be modified to your liking, or you can add new ones.
<link linkend="language.function.html.options"><command>html_options</command></link> and
<link linkend="language.function.html.select.date"><command>html_select_date</command></link>
are examples of custom functions.
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -28,8 +28,11 @@ PRACTICAL EXAMPLES:
]]>
</programlisting>
</example>
<para>See also <link linkend="language.modifier.escape">escape</link></para>
<para>
See also <link linkend="language.modifier.escape">escape</link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -8,7 +8,8 @@
that are indexed numerically or non-numerically. You can also reference
object properties and methods. Config file variables are an exception to the
dollar sign syntax. They can be referenced with surrounding hashmarks, or
with the special $smarty.config variable.
with the special
<link linkend="language.variables.smarty.config">$smarty.config</link> variable.
</para>
<example>
<title>Variables</title>
@@ -23,6 +24,7 @@
{#foo#} <-- display the config file variable "foo"
{$smarty.config.foo} <-- synonym for {#foo#}
{$foo[bar]} <-- syntax only valid in a section loop, see {section}
{assign var=foo value="baa"}{$foo} <-- displays "baa", see {assign}
Many other combinations are allowed
@@ -36,9 +38,12 @@ Many other combinations are allowed
]]>
</programlisting>
</example>
<para>See also <link linkend="language.variables.smarty">$smarty reserved variables</link>
and <link linkend="language.config.variables">Config Variables</link></para>
<para>
See also <link linkend="language.variables.smarty">$smarty reserved variables</link>
and <link linkend="language.config.variables">Config Variables</link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -41,10 +41,11 @@
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.
template from the special variable <link
linkend="language.variables.smarty.capture">$smarty.capture.foo</link>
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.
</para>
<note>
<title>Technical Note</title>
@@ -56,10 +57,11 @@
</note>
<caution>
<para>
Be careful when capturing <command>insert</command> output. If
you have caching turned on and you have <command>insert</command>
commands that you expect to run within cached content, do not
capture this content.
Be careful when capturing <link
linkend="language.function.insert"><command>insert</command></link>
output. If you have caching turned on and you have
<command>insert</command> commands that you expect to run
within cached content, do not capture this content.
</para>
</caution>
<para>
@@ -82,7 +84,11 @@
</programlisting>
</example>
</para>
<para>
See also <link linkend="language.function.assign">assign </link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -59,13 +59,16 @@
</note>
<para>
include_php tags are used to include a php script in your template.
If security is enabled, then the php script must be located in the
$trusted_dir path. The include_php tag must have the attribute
If <link linkend="variable.security">security is enabled</link>,
then the php script must be located in the <link
linkend="variable.trusted.dir">$trusted_dir</link> path.
The include_php tag must have the attribute
"file", which contains the path to the included php file, either
relative to $trusted_dir, or an absolute path.
</para>
<para>
include_php is a nice way to handle componentized templates, and
include_php is a nice way to handle <link
linkend="tips.componentized.templates">componentized templates</link>, and
keep PHP code separate from the template files. Lets say you have a
template that shows your site navigation, which is pulled
dynamically from a database. You can keep your PHP logic that grabs

View File

@@ -53,10 +53,11 @@
</tgroup>
</informaltable>
<para>
Insert tags work much like include tags, except that insert tags
are not cached when you have template <link
linkend="caching">caching</link> enabled. They will be
executed on every invocation of the template.
Insert tags work much like <link
linkend="language.function.include">include</link> tags,
except that insert tags are not cached when you have
template <link linkend="caching">caching</link> enabled. They
will be executed on every invocation of the template.
</para>
<para>
Let's say you have a template with a banner slot at the top of
@@ -71,7 +72,8 @@
<title>function insert</title>
<programlisting>
{* example of fetching a banner *}
{insert name="getBanner" lid=#banner_location_id# sid=#site_id#}</programlisting>
{insert name="getBanner" lid=#banner_location_id# sid=#site_id#}
</programlisting>
</example>
<para>
In this example, we are using the name "getBanner" and passing the
@@ -98,8 +100,9 @@
included (only once) before the insert function is executed. This
is the case where the insert function may not exist yet, and a php
script must be included first to make it work. The path can be
either absolute, or relative to $trusted_dir. When security is
enabled, the script must reside in $trusted_dir.
either absolute, or relative to $trusted_dir. When <link
linkend="variable.security">security is enabled</link>, the script
must reside in <link linkend="variable.trusted.dir">$trusted_dir</link>.
</para>
<para>
The Smarty object is passed as the second argument. This way you

View File

@@ -284,7 +284,8 @@
<title>Technical Note</title>
<para>
If the step and start section properties are not
modified, then this works the same as the iteration section
modified, then this works the same as the <link
linkend="section.property.iteration">iteration</link> section
property, except it starts on 0 instead of 1.
</para>
</note>
@@ -386,9 +387,10 @@
<note>
<para>
This is not affected by the section properties start, step and
max, unlike the index property. Iteration also starts with 1
instead of 0 like index. rownum is an alias to iteration, they work
identical.
max, unlike the <link linkend="section.property.index">index</link>
property. Iteration also starts with 1 instead of 0 like index. <link
linkend="section.property.rownum">rownum</link> is an alias to iteration,
they work identical.
</para>
</note>
<example>
@@ -503,7 +505,8 @@
<title>rownum</title>
<para>
rownum is used to display the current loop iteration,
starting with one. It is an alias to iteration, they work
starting with one. It is an alias to <link
linkend="section.property.iteration">iteration</link>, they work
identically.
</para>
<example>
@@ -627,8 +630,13 @@
]]>
</screen>
</example>
<para>
See also <link linkend="language.function.foreach">foreach</link>
and <link linkend="language.variables.smarty.loops">$smarty.section</link>.
</para>
</sect2>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -33,8 +33,8 @@ index.tpl:
<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 .
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 ....snip.... H C U T S E F F I C I E N C Y .
s m o k e r s a r ....snip.... 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. . .
]]>

View File

@@ -67,12 +67,13 @@ Cold Wave Linked to Temperatures.
]]>
</screen>
</example>
<para>See also <link linkend="language.modifier.count.paragraphs">count_paragraphs</link>,
<para>
See also <link linkend="language.modifier.count.paragraphs">count_paragraphs</link>,
<link linkend="language.modifier.count.sentences">count_sentences</link> and
<link linkend="language.modifier.count.words">count_words</link>
<link linkend="language.modifier.count.words">count_words</link>.
</para>
</sect1>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -38,12 +38,13 @@ Man is Fatally Slain. Death Causes Loneliness, Feeling of Isolation.
]]>
</screen>
</example>
<para>See also <link linkend="language.modifier.count.characters">count_characters</link>,
<para>
See also <link linkend="language.modifier.count.characters">count_characters</link>,
<link linkend="language.modifier.count.sentences">count_sentences</link> and
<link linkend="language.modifier.count.words">count_words</link>
<link linkend="language.modifier.count.words">count_words</link>.
</para>
</sect1>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -37,12 +37,13 @@ Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe.
]]>
</screen>
</example>
<para>See also <link linkend="language.modifier.count.characters">count_characters</link>,
<para>
See also <link linkend="language.modifier.count.characters">count_characters</link>,
<link linkend="language.modifier.count.paragraphs">count_paragraphs</link> and
<link linkend="language.modifier.count.words">count_words</link>
<link linkend="language.modifier.count.words">count_words</link>.
</para>
</sect1>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -37,13 +37,13 @@ Dealers Will Hear Car Talk at Noon.
]]>
</screen>
</example>
<para>See also <link linkend="language.modifier.count.characters">count_characters</link>,
<para>
See also <link linkend="language.modifier.count.characters">count_characters</link>,
<link linkend="language.modifier.count.paragraphs">count_paragraphs</link> and
<link linkend="language.modifier.count.sentences">count_sentences</link>
<link linkend="language.modifier.count.sentences">count_sentences</link>.
</para>
</sect1>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -211,8 +211,13 @@ Monday, February 5, 2001
</para>
</note>
</para>
<para>See also <link linkend="language.variables.smarty.now">$smarty.now</link>, <link linkend="language.function.html.select.date">{html_select_date}</link> and <link linkend="tips.dates">date tips</link></para>
</sect1>
<para>
See also <link linkend="language.variables.smarty.now">$smarty.now</link>,
<link linkend="language.function.html.select.date">{html_select_date}</link>
and <link linkend="tips.dates">date tips</link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -67,9 +67,12 @@ no title
]]>
</screen>
</example>
<para>See also <link linkend="tips.default.var.handling">Default Variable Handling</link> and <link linkend="tips.blank.var.handling">Blank Variable Handling</link></para>
<para>
See also <link linkend="tips.default.var.handling">Default Variable Handling</link>
and <link linkend="tips.blank.var.handling">Blank Variable Handling</link>.
</para>
</sect1>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -81,7 +81,8 @@ $smarty->display('index.tpl');
</screen>
</example>
<para>
See also <link linkend="language.escaping">Escaping Smarty Parsing</link> and <link linkend="tips.obfuscating.email">Obfuscating E-mail Addresses</link>.
See also <link linkend="language.escaping">Escaping Smarty Parsing</link>
and <link linkend="tips.obfuscating.email">Obfuscating E-mail Addresses</link>.
</para>
</sect1>

View File

@@ -95,7 +95,12 @@ Statistics show that teen pregnancy drops off significantly after 25.
]]>
</screen>
</example>
</sect1>
<para>
See also <link linkend="language.modifier.strip">strip</link>
and <link linkend="language.modifier.spacify">spacify</link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -4,7 +4,8 @@
<title>nl2br</title>
<para>
All linebreaks will be converted to &lt;br /&gt; tags in the given
variable. This is equivalent to the PHP <ulink url="&url.php-manual;nl2br">nl2br()</ulink> function.
variable. This is equivalent to the PHP
<ulink url="&url.php-manual;nl2br">nl2br()</ulink> function.
</para>
<example>
<title>nl2br</title>
@@ -36,8 +37,13 @@ Sun or rain expected<br />today, dark tonight
]]>
</screen>
</example>
<para>See also <link linkend="language.modifier.wordwrap">word_wrap</link>, <link linkend="language.modifier.count.paragraphs">count_paragraphs</link> and <link linkend="language.modifier.count.sentences">count_sentences</link></para>
</sect1>
<para>
See also <link linkend="language.modifier.wordwrap">word_wrap</link>,
<link linkend="language.modifier.count.paragraphs">count_paragraphs</link>
and <link linkend="language.modifier.count.sentences">count_sentences</link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -38,7 +38,8 @@
</informaltable>
<para>
A regular expression search and replace on a variable. Use the
syntax for preg_replace() from the PHP manual.
syntax for <ulink
url="&url.php-manual;preg_replace">preg_replace()</ulink> from the PHP manual.
</para>
<example>
<title>regex_replace</title>
@@ -75,7 +76,12 @@ Infertility unlikely to be passed on, experts say.
]]>
</screen>
</example>
</sect1>
<para>
See also <link linkend="language.modifier.replace">replace</link>
and <link linkend="language.modifier.escape">escape</link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -37,7 +37,8 @@
</tgroup>
</informaltable>
<para>
A simple search and replace on a variable.
A simple search and replace on a variable. This is equivalent to the PHP
<ulink url="&url.php-manual;str_replace">str_replace()</ulink> function.
</para>
<example>
<title>replace</title>
@@ -73,7 +74,12 @@ Child's Stool Great for Use in Garden.
]]>
</screen>
</example>
</sect1>
<para>
See also <link linkend="language.modifier.regex.replace">regex_replace</link>
and <link linkend="language.modifier.escape">escape</link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -61,12 +61,17 @@ $smarty->display('index.tpl');
<screen>
<![CDATA[
Something Went Wrong in Jet Crash, Experts Say.
S o m e t h i n g W e n t W r o n g i n J e t C r a s h , E x p e r t s S a y .
S^^o^^m^^e^^t^^h^^i^^n^^g^^ ^^W^^e^^n^^t^^ ^^W^^r^^o^^n^^g^^ ^^i^^n^^ ^^J^^e^^t^^ ^^C^^r^^a^^s^^h^^,^^ ^^E^^x^^p^^e^^r^^t^^s^^ ^^S^^a^^y^^.
S o m e t h i n g W .... snip .... s h , E x p e r t s S a y .
S^^o^^m^^e^^t^^h^^i^^n^^g^^ .... snip .... ^^e^^r^^t^^s^^ ^^S^^a^^y^^.
]]>
</screen>
</example>
</sect1>
<para>
See also <link linkend="language.modifier.wordwrap">wordwrap</link>
and <link linkend="language.modifier.nl2br">nl2br</link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -31,7 +31,8 @@
</informaltable>
<para>
This is a way to format strings, such as decimal numbers and such.
Use the syntax for sprintf for the formatting.
Use the syntax for <ulink url="&url.php-manual;sprintf">sprintf</ulink>
for the formatting.
</para>
<example>
<title>string_format</title>
@@ -67,7 +68,11 @@ $smarty->display('index.tpl');
]]>
</screen>
</example>
</sect1>
<para>
See also <link linkend="language.modifier.date.format">date_format</link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -51,7 +51,8 @@
to wrap the text to the next line (default is carriage return \n).
By default, wordwrap will attempt to wrap at a word boundary. If
you want to cut off at the exact character length, pass the optional
third parameter of true.
third parameter of true. This is equivalent to the PHP <ulink
url="&url.php-manual;wordwrap">wordwrap()</ulink> function.
</para>
<example>
<title>wordwrap</title>
@@ -108,8 +109,11 @@ years.
]]>
</screen>
</example>
<para>See also <link linkend="language.modifier.nl2br">nl2br</link></para>
</sect1>
<para>
See also <link linkend="language.modifier.nl2br">nl2br</link>.
</para>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.assigned.variables">
<sect1 id="language.assigned.variables">
<title>Variables assigned from PHP</title>
<para>
Variables that are assigned from PHP are referenced by preceding them with
@@ -9,7 +9,6 @@
function are also displayed this way.
</para>
<example>
<title>assigned variables</title>
<programlisting>
<![CDATA[
@@ -29,7 +28,6 @@ Your last login was on January 11th, 2001.
]]>
</screen>
</example>
<sect2 id="language.variables.assoc.arrays">
<title>Associative arrays</title>
<para>
@@ -128,8 +126,9 @@ zaphod@slartibartfast.com<br />
<sect2 id="language.variables.objects">
<title>Objects</title>
<para>
Properties of objects assigned from PHP can be referenced
by specifying the property name after the '-&gt;' symbol.
Properties of <link linkend="advanced.features.objects">objects</link>
assigned from PHP can be referenced by specifying the property
name after the '-&gt;' symbol.
</para>
<example>
<title>accessing object properties</title>
@@ -151,6 +150,7 @@ email: zaphod@slartibartfast.com<br />
</example>
</sect2>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml