mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
*** empty log message ***
This commit is contained in:
@@ -88,7 +88,7 @@ Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75
|
|||||||
If a variable is used frequently throughout your templates, applying
|
If a variable is used frequently throughout your templates, applying
|
||||||
the default modifier every time it is mentioned can get a bit ugly. You
|
the default modifier every time it is mentioned can get a bit ugly. You
|
||||||
can remedy this by assigning the variable its default value with the
|
can remedy this by assigning the variable its default value with the
|
||||||
<link linkend="language.functions.assign">assign</link> function.
|
<link linkend="language.function.assign">assign</link> function.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>Assigning a template variable its default value</title>
|
<title>Assigning a template variable its default value</title>
|
||||||
|
@@ -1,24 +1,29 @@
|
|||||||
<part>
|
<part>
|
||||||
<title>Smarty For Template Designers</title>
|
<title>Smarty For Template Designers</title>
|
||||||
<chapter id="language">
|
<chapter id="language">
|
||||||
<title>Template Language</title>
|
<title>Template Language</title>
|
||||||
<para>
|
<para>
|
||||||
The templates are the heart of Smarty. These are the files that the designers
|
The templates are the language of Smarty. These are the files that the designers
|
||||||
work with. They're basically pages made up of static content interspersed with
|
work with. They're basically pages made up of static content interspersed with
|
||||||
template markup tags. These tags are placeholders for variables or blocks of logic.
|
template markup tags. These tags are placeholders for variables or blocks of logic.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<sect1 id="language.basic.syntax">
|
<sect1 id="language.basic.syntax">
|
||||||
<title>Basic Syntax</title>
|
<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>
|
<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
|
||||||
template tag delimiters, which are "{" and "}". In Smarty, all content
|
delimiters. In Smarty, all content outside of delimiters is displayed as
|
||||||
outside of delimiter tags is displayed as static content, or unchanged.
|
static content, or unchanged. When Smarty encounters template tags, it
|
||||||
When Smarty encounters template tags {}, it attempts to interpret what is
|
attempts to interpret them, and displays the appropriate output in their
|
||||||
between the tags, and displays the appropriate output in place of them.
|
place.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<sect2 id="language.basic.syntax.comments">
|
<sect2 id="language.syntax.comments">
|
||||||
<title>Comments</title>
|
<title>Comments</title>
|
||||||
<para>
|
<para>
|
||||||
Template comments are surrounded by asterisks, and that is surrounded
|
Template comments are surrounded by asterisks, and that is surrounded
|
||||||
@@ -44,38 +49,19 @@
|
|||||||
</SELECT></programlisting>
|
</SELECT></programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2>
|
|
||||||
<title>Attributes</title>
|
|
||||||
<para>
|
|
||||||
Attributes to functions are much like HTML attributes. Static
|
|
||||||
values don't have to be enclosed in quotes, but it is recommended
|
|
||||||
for literal strings. If not quoted, you may use a syntax that Smarty may confuse
|
|
||||||
with another function, such as a boolean value. Variables may
|
|
||||||
also be used, and should not be in quotes.
|
|
||||||
</para>
|
|
||||||
<example>
|
|
||||||
<title>function attribute syntax</title>
|
|
||||||
<programlisting>
|
|
||||||
{include file="header.tpl"}
|
|
||||||
|
|
||||||
{include file=$includeFile}
|
<sect2 id="language.syntax.functions">
|
||||||
|
<title>Functions</title>
|
||||||
{include file=#includeFile#}
|
<para>
|
||||||
|
Each Smarty tag either prints a
|
||||||
<SELECT name=company>
|
<link linkend="language.variables">variable</link> or invokes some sort
|
||||||
{html_options values=$vals selected=$selected output=$output}
|
of function. Functions are processed and displayed by enclosing the
|
||||||
</SELECT></programlisting>
|
function and its attributes into delimiters like so: {funcname
|
||||||
</example>
|
attr1="val" attr2="val"}.
|
||||||
</sect2>
|
</para>
|
||||||
<sect2>
|
<example>
|
||||||
<title>blah</title>
|
<title>function syntax</title>
|
||||||
<para>
|
<programlisting>
|
||||||
Functions are processed and displayed by enclosing the function and its
|
|
||||||
attributes into delimiters like so: {funcname attr1="val" attr2="val"}
|
|
||||||
</para>
|
|
||||||
<example>
|
|
||||||
<title>function syntax</title>
|
|
||||||
<programlisting>
|
|
||||||
{config_load file="colors.conf"}
|
{config_load file="colors.conf"}
|
||||||
|
|
||||||
{include file="header.tpl"}
|
{include file="header.tpl"}
|
||||||
@@ -87,22 +73,51 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{include file="footer.tpl"}</programlisting>
|
{include file="footer.tpl"}</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 <command>if</command>, <command>section</command> and
|
||||||
|
<command>strip</command>. 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. <command>html_options</command> and
|
||||||
|
<command>html_select_date</command> are examples of custom functions.
|
||||||
|
</para>
|
||||||
|
</sect2>
|
||||||
|
|
||||||
|
<sect2 id="language.syntax.attributes">
|
||||||
|
<title>Attributes</title>
|
||||||
|
<para>
|
||||||
|
Most of the functions take attributes that specify or modify
|
||||||
|
their behavior. Attributes to Smarty functions are much like HTML
|
||||||
|
attributes. Static values don't have to be enclosed in quotes, but it
|
||||||
|
is recommended for literal strings. Variables may also be used, and
|
||||||
|
should not be in quotes.
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Some attributes require boolean values (true or false). These can be
|
||||||
|
specified as either unquoted <literal>true</literal>,
|
||||||
|
<literal>on</literal>, and <literal>yes</literal>, or
|
||||||
|
<literal>false</literal>, <literal>off</literal>, and
|
||||||
|
<literal>no</literal>.
|
||||||
|
</para>
|
||||||
|
<example>
|
||||||
|
<title>function attribute syntax</title>
|
||||||
|
<programlisting>
|
||||||
|
{include file="header.tpl"}
|
||||||
|
|
||||||
|
{include file=$includeFile}
|
||||||
|
|
||||||
|
{include file=#includeFile#}
|
||||||
|
|
||||||
|
{html_select_date display_days=yes}
|
||||||
|
|
||||||
|
<SELECT name=company>
|
||||||
|
{html_options values=$vals selected=$selected output=$output}
|
||||||
|
</SELECT></programlisting>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
</sect2>
|
||||||
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 {if}, {section} and {strip}. They cannot be
|
|
||||||
modified. Custom functions are located in the Smarty.addons.class
|
|
||||||
file. They can be modified to your liking, or add new ones.
|
|
||||||
{html_options} and {html_select_date} are examples of custom
|
|
||||||
functions.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
Custom functions in Smarty work much the same as the built-in functions,
|
|
||||||
except that built-in functions cannot be modified. Custom functions are
|
|
||||||
located in Smarty.addons.php, built-in functions are not.
|
|
||||||
</para>
|
|
||||||
</sect2>
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<sect1 id="language.variables">
|
<sect1 id="language.variables">
|
||||||
@@ -1194,14 +1209,14 @@ s m o k e r s a r e p. . .</programlisting>
|
|||||||
</sect2>
|
</sect2>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<sect1 id="language.commands">
|
<sect1 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>
|
||||||
<sect2 id="builtin.functions.capture">
|
<sect2 id="language.function.capture">
|
||||||
<title>capture</title>
|
<title>capture</title>
|
||||||
<para>
|
<para>
|
||||||
capture is used to collect the output of the template into a
|
capture is used to collect the output of the template into a
|
||||||
@@ -1246,7 +1261,7 @@ s m o k e r s a r e p. . .</programlisting>
|
|||||||
</example>
|
</example>
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="builtin.functions.configload">
|
<sect2 id="language.function.config.load">
|
||||||
<title>config_load</title>
|
<title>config_load</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=5>
|
<tgroup cols=5>
|
||||||
@@ -1364,7 +1379,7 @@ s m o k e r s a r e p. . .</programlisting>
|
|||||||
</html></programlisting>
|
</html></programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="builtin.functions.include">
|
<sect2 id="language.function.include">
|
||||||
<title>include</title>
|
<title>include</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=5>
|
<tgroup cols=5>
|
||||||
@@ -1466,7 +1481,7 @@ s m o k e r s a r e p. . .</programlisting>
|
|||||||
{include file="db:header.tpl"}</programlisting>
|
{include file="db:header.tpl"}</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="builtin.functions.include.php">
|
<sect2 id="language.function.include.php">
|
||||||
<title>include_php</title>
|
<title>include_php</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=5>
|
<tgroup cols=5>
|
||||||
@@ -1557,7 +1572,7 @@ index.tpl
|
|||||||
{/foreach}</programlisting>
|
{/foreach}</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="builtin.functions.insert">
|
<sect2 id="language.function.insert">
|
||||||
<title>insert</title>
|
<title>insert</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=5>
|
<tgroup cols=5>
|
||||||
@@ -1673,7 +1688,7 @@ index.tpl
|
|||||||
weather, search results, user feedback areas, etc.
|
weather, search results, user feedback areas, etc.
|
||||||
</para>
|
</para>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2>
|
<sect2 id="language.function.if">
|
||||||
<title>if,elseif,else</title>
|
<title>if,elseif,else</title>
|
||||||
<para>
|
<para>
|
||||||
if statements in Smarty have much the same flexibility as php if
|
if statements in Smarty have much the same flexibility as php if
|
||||||
@@ -1753,7 +1768,7 @@ index.tpl
|
|||||||
{/if}</programlisting>
|
{/if}</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2>
|
<sect2 id="language.function.ldelim">
|
||||||
<title>ldelim,rdelim</title>
|
<title>ldelim,rdelim</title>
|
||||||
<para>
|
<para>
|
||||||
ldelim and rdelim are used for displaying the literal delimiter, in
|
ldelim and rdelim are used for displaying the literal delimiter, in
|
||||||
@@ -1773,7 +1788,7 @@ OUTPUT:
|
|||||||
{funcname} is how functions look in Smarty!</programlisting>
|
{funcname} is how functions look in Smarty!</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="builtin.functions.literal">
|
<sect2 id="language.function.literal">
|
||||||
<title>literal</title>
|
<title>literal</title>
|
||||||
<para>
|
<para>
|
||||||
Literal tags allow a block of data to be taken literally,
|
Literal tags allow a block of data to be taken literally,
|
||||||
@@ -1805,7 +1820,7 @@ OUTPUT:
|
|||||||
{/literal}</programlisting>
|
{/literal}</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="builtin.functions.php">
|
<sect2 id="language.function.php">
|
||||||
<title>php</title>
|
<title>php</title>
|
||||||
<para>
|
<para>
|
||||||
php tags allow php to be embedded directly into the template. They
|
php tags allow php to be embedded directly into the template. They
|
||||||
@@ -1824,7 +1839,7 @@ OUTPUT:
|
|||||||
{/php}</programlisting>
|
{/php}</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="builtin.functions.section">
|
<sect2 id="language.function.section">
|
||||||
<title>section,sectionelse</title>
|
<title>section,sectionelse</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=5>
|
<tgroup cols=5>
|
||||||
@@ -2370,7 +2385,7 @@ e-mail: jane@mydomain.com<p></programlisting>
|
|||||||
</example>
|
</example>
|
||||||
</sect3>
|
</sect3>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="builtin.functions.foreach">
|
<sect2 id="language.function.foreach">
|
||||||
<title>foreach,foreachelse</title>
|
<title>foreach,foreachelse</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=5>
|
<tgroup cols=5>
|
||||||
@@ -2484,7 +2499,7 @@ fax: 555-3333<br>
|
|||||||
cell: 760-1234<br></programlisting>
|
cell: 760-1234<br></programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2>
|
<sect2 id="language.function.strip">
|
||||||
<title>strip</title>
|
<title>strip</title>
|
||||||
<para>
|
<para>
|
||||||
Many times web designers
|
Many times web designers
|
||||||
@@ -2531,16 +2546,16 @@ OUTPUT:
|
|||||||
</sect2>
|
</sect2>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<sect1 id="language.additional.functions">
|
<sect1 id="language.more.functions">
|
||||||
<title>Additional Functions</title>
|
<title>Custom Functions</title>
|
||||||
<para>
|
<para>
|
||||||
Smarty comes with several additional functions that you can
|
Smarty comes with several additional functions that you can
|
||||||
use in the templates.
|
use in the templates.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<sect2 id="language.available.functions">
|
<sect2 id="language.custom.functions">
|
||||||
<title>Available Functions</title>
|
<title>Additional Functions</title>
|
||||||
<sect3 id="language.functions.assign">
|
<sect3 id="language.function.assign">
|
||||||
<title>assign</title>
|
<title>assign</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=5>
|
<tgroup cols=5>
|
||||||
@@ -2595,7 +2610,7 @@ OUTPUT:
|
|||||||
The value of $name is Bob.</programlisting>
|
The value of $name is Bob.</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect3>
|
</sect3>
|
||||||
<sect3>
|
<sect3 id="language.function.counter">
|
||||||
<title>counter</title>
|
<title>counter</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=5>
|
<tgroup cols=5>
|
||||||
@@ -2692,7 +2707,7 @@ OUTPUT:
|
|||||||
8<br></programlisting>
|
8<br></programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect3>
|
</sect3>
|
||||||
<sect3>
|
<sect3 id="language.function.fetch">
|
||||||
<title>fetch</title>
|
<title>fetch</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=5>
|
<tgroup cols=5>
|
||||||
@@ -2771,7 +2786,7 @@ OUTPUT:
|
|||||||
{/if}</programlisting>
|
{/if}</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect3>
|
</sect3>
|
||||||
<sect3 id="language.functions.html.options">
|
<sect3 id="language.function.html.options">
|
||||||
<title>html_options</title>
|
<title>html_options</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=5>
|
<tgroup cols=5>
|
||||||
@@ -2861,7 +2876,7 @@ OUTPUT:
|
|||||||
</select></programlisting>
|
</select></programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect3>
|
</sect3>
|
||||||
<sect3 id="language.functions.html.select.date">
|
<sect3 id="language.function.html.select.date">
|
||||||
<title>html_select_date</title>
|
<title>html_select_date</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=5>
|
<tgroup cols=5>
|
||||||
@@ -3141,7 +3156,7 @@ OUTPUT:
|
|||||||
</select></programlisting>
|
</select></programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect3>
|
</sect3>
|
||||||
<sect3 id="language.functions.html.select.time">
|
<sect3 id="language.function.html.select.time">
|
||||||
<title>html_select_time</title>
|
<title>html_select_time</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=5>
|
<tgroup cols=5>
|
||||||
@@ -3402,7 +3417,7 @@ OUTPUT:
|
|||||||
</select></programlisting>
|
</select></programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect3>
|
</sect3>
|
||||||
<sect3 id="language.functions.math">
|
<sect3 id="language.function.math">
|
||||||
<title>math</title>
|
<title>math</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=5>
|
<tgroup cols=5>
|
||||||
@@ -3516,14 +3531,14 @@ OUTPUT:
|
|||||||
9.44</programlisting>
|
9.44</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect3>
|
</sect3>
|
||||||
<sect3 id="language.functions.popup.init">
|
<sect3 id="language.function.popup.init">
|
||||||
<title>popup_init</title>
|
<title>popup_init</title>
|
||||||
<para>
|
<para>
|
||||||
popup is an integration of overLib, a library used for popup
|
popup is an integration of overLib, a library used for popup
|
||||||
windows. These are used for context sensitive information, such as
|
windows. These are used for context sensitive information, such as
|
||||||
help windows or tooltips. popup_init must be called once at the
|
help windows or tooltips. popup_init must be called once at the
|
||||||
top of any page you plan on using the <link
|
top of any page you plan on using the <link
|
||||||
linkend="language.functions.popup">popup</link> function. overLib
|
linkend="language.function.popup">popup</link> function. overLib
|
||||||
was written by Erik Bosrup, and the homepage is located at
|
was written by Erik Bosrup, and the homepage is located at
|
||||||
http://www.bosrup.com/web/overlib/.
|
http://www.bosrup.com/web/overlib/.
|
||||||
</para>
|
</para>
|
||||||
@@ -3531,7 +3546,7 @@ OUTPUT:
|
|||||||
This was added to Smarty 1.4.4.
|
This was added to Smarty 1.4.4.
|
||||||
</para>
|
</para>
|
||||||
</sect3>
|
</sect3>
|
||||||
<sect3 id="language.functions.popup">
|
<sect3 id="language.function.popup">
|
||||||
<title>popup</title>
|
<title>popup</title>
|
||||||
<informaltable frame=all>
|
<informaltable frame=all>
|
||||||
<tgroup cols=5>
|
<tgroup cols=5>
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
<part id="getting.started">
|
<part id="getting.started">
|
||||||
<title>Getting Started</title>
|
<title>Getting Started</title>
|
||||||
|
|
||||||
<chapter id="overview">
|
<chapter id="overview">
|
||||||
<title>Overview</title>
|
<title>Overview</title>
|
||||||
<sect1 id="what.is.smarty">
|
<sect1 id="what.is.smarty">
|
||||||
@@ -95,67 +96,67 @@
|
|||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
<chapter id="installation">
|
<chapter id="installation">
|
||||||
<title>Installation</title>
|
<title>Installation</title>
|
||||||
|
|
||||||
<sect1 id="installation.requirements">
|
<sect1 id="installation.requirements">
|
||||||
<title>Requirements</title>
|
<title>Requirements</title>
|
||||||
<para>
|
<para>
|
||||||
Smarty requires PHP 4.0.4pl1 or later. See the
|
Smarty requires PHP 4.0.4pl1 or later. See the
|
||||||
<link linkend="bugs">BUGS</link> section for caveats.
|
<link linkend="bugs">BUGS</link> section for caveats.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
<sect1 id="installation.smarty">
|
<sect1 id="installing.smarty">
|
||||||
<title>Installing Smarty</title>
|
<title>Installing Smarty</title>
|
||||||
<para>
|
<para>
|
||||||
Installing Smarty is fairly straightforward, there are a few things to
|
Installing Smarty is fairly straightforward, there are a few things to
|
||||||
be aware of. Smarty creates PHP scripts from the templates. This
|
be aware of. Smarty creates PHP scripts from the templates. This
|
||||||
usually means allowing user "nobody" (or whomever the web server runs
|
usually means allowing user "nobody" (or whomever the web server runs
|
||||||
as) to have permission to write the files. Each installation of a
|
as) to have permission to write the files. Each installation of a
|
||||||
Smarty application minimally needs a templates directory and a compiled
|
Smarty application minimally needs a templates directory and a compiled
|
||||||
templates directory. If you use configuration files you will also need
|
templates directory. If you use configuration files you will also need
|
||||||
a directory for those. By default these are named "templates",
|
a directory for those. By default these are named "templates",
|
||||||
"templates_c" and "configs" respectively. If you plan on using caching,
|
"templates_c" and "configs" respectively. If you plan on using caching,
|
||||||
you will need to create a "cache" directory, also with permission to
|
you will need to create a "cache" directory, also with permission to
|
||||||
write files.
|
write files.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
TECHNICAL NOTE: You can get around the need to allow the web server
|
TECHNICAL NOTE: You can get around the need to allow the web server
|
||||||
user write access to compile templates. Smarty needs to compile the
|
user write access to compile templates. Smarty needs to compile the
|
||||||
templates only once. This can be done from the command line, using the
|
templates only once. This can be done from the command line, using the
|
||||||
CGI version of PHP. example: "php -q index.php". Once the templates are
|
CGI version of PHP. example: "php -q index.php". Once the templates are
|
||||||
compiled, they should run fine from the web environment. If you change
|
compiled, they should run fine from the web environment. If you change
|
||||||
a template, you must recompile from the command line again. If you do
|
a template, you must recompile from the command line again. If you do
|
||||||
not have the CGI version of PHP available and you are concerned about
|
not have the CGI version of PHP available and you are concerned about
|
||||||
world-writable directory access, you can chmod 777 the compile_dir, let
|
world-writable directory access, you can chmod 777 the compile_dir, let
|
||||||
the templates compile once as the web server user, then change the
|
the templates compile once as the web server user, then change the
|
||||||
directory mode to 755. If you are using the caching feature of Smarty,
|
directory mode to 755. If you are using the caching feature of Smarty,
|
||||||
the cache directory must always have write access for the web server
|
the cache directory must always have write access for the web server
|
||||||
user.
|
user.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
TECHNICAL NOTE: If you do not have access to the php.ini file, you can
|
TECHNICAL NOTE: If you do not have access to the php.ini file, you can
|
||||||
change non-server settings (such as your include_path) with the
|
change non-server settings (such as your include_path) with the
|
||||||
ini_set() command (available in PHP 4.0.4 or later.) example:
|
ini_set() command (available in PHP 4.0.4 or later.) example:
|
||||||
ini_set("include_path",".:/usr/local/lib/php");
|
ini_set("include_path",".:/usr/local/lib/php");
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
Copy the Smarty.class.php, Smarty.addons.php and Config_File.class.php
|
Copy the Smarty.class.php, Smarty.addons.php and Config_File.class.php
|
||||||
scripts to a directory that is in your PHP include_path. NOTE: PHP will
|
scripts to a directory that is in your PHP include_path. NOTE: PHP will
|
||||||
try to create a directory alongside the executing script called
|
try to create a directory alongside the executing script called
|
||||||
"templates_c". Be sure that directory permissions allow this to happen.
|
"templates_c". Be sure that directory permissions allow this to happen.
|
||||||
You will see PHP error messages if this fails. You can also create the
|
You will see PHP error messages if this fails. You can also create the
|
||||||
directory yourself before hand, and change the file ownership
|
directory yourself before hand, and change the file ownership
|
||||||
accordingly. See below.
|
accordingly. See below.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
<para>
|
||||||
TECHNICAL NOTE: If you don't want to use include_path to find the
|
TECHNICAL NOTE: If you don't want to use include_path to find the
|
||||||
Smarty files, you can set the SMARTY_DIR constant to the full path to
|
Smarty files, you can set the SMARTY_DIR constant to the full path to
|
||||||
your Smarty library files. Be sure the path ends with a slash!
|
your Smarty library files. Be sure the path ends with a slash!
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>Example of installing Smarty</title>
|
<title>Example of installing Smarty</title>
|
||||||
<screen>
|
<screen>
|
||||||
# be sure you are in the web server document tree
|
# be sure you are in the web server document tree
|
||||||
# this assumes your web server runs as user "nobody"
|
# this assumes your web server runs as user "nobody"
|
||||||
# and you are in a un*x environment
|
# and you are in a un*x environment
|
||||||
@@ -167,32 +168,33 @@ chmod 700 templates_c
|
|||||||
mkdir cache
|
mkdir cache
|
||||||
chown nobody:nobody cache
|
chown nobody:nobody cache
|
||||||
chmod 700 cache</screen>
|
chmod 700 cache</screen>
|
||||||
</example>
|
</example>
|
||||||
<para>
|
<para>
|
||||||
Next, try running the index.php script from your web browser.
|
Next, try running the index.php script from your web browser.
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
<sect1 id="smarty.constants">
|
|
||||||
<title>Constants</title>
|
|
||||||
<para></para>
|
|
||||||
|
|
||||||
<sect2 id="constant.smarty.dir">
|
<sect1 id="smarty.constants">
|
||||||
<title>SMARTY_DIR</title>
|
<title>Constants</title>
|
||||||
<para>
|
<para></para>
|
||||||
This should be the full system path to the location of the Smarty
|
|
||||||
class files. If this is not defined, then Smarty will attempt to
|
<sect2 id="constant.smarty.dir">
|
||||||
determine the appropriate value automatically. If defined, the path
|
<title>SMARTY_DIR</title>
|
||||||
must end with a slash.
|
<para>
|
||||||
</para>
|
This should be the full system path to the location of the Smarty
|
||||||
<example>
|
class files. If this is not defined, then Smarty will attempt to
|
||||||
<title>SMARTY_DIR</title>
|
determine the appropriate value automatically. If defined, the path
|
||||||
<programlisting>
|
must end with a slash.
|
||||||
|
</para>
|
||||||
|
<example>
|
||||||
|
<title>SMARTY_DIR</title>
|
||||||
|
<programlisting>
|
||||||
// set path to Smarty directory
|
// set path to Smarty directory
|
||||||
define("SMARTY_DIR","/usr/local/lib/php/Smarty/");
|
define("SMARTY_DIR","/usr/local/lib/php/Smarty/");
|
||||||
|
|
||||||
require_once(SMARTY_DIR."Smarty.class.php");</programlisting>
|
require_once(SMARTY_DIR."Smarty.class.php");</programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
</sect1>
|
</sect1>
|
||||||
</chapter>
|
</chapter>
|
||||||
</part>
|
</part>
|
||||||
|
@@ -181,6 +181,52 @@
|
|||||||
)
|
)
|
||||||
(literal "()"))))))))
|
(literal "()"))))))))
|
||||||
|
|
||||||
|
(element command
|
||||||
|
(let* ((command-name (data (current-node)))
|
||||||
|
(linkend
|
||||||
|
(string-append
|
||||||
|
"language.function."
|
||||||
|
(string-replace
|
||||||
|
(string-replace command-name "_" ".")
|
||||||
|
"::" ".")))
|
||||||
|
(target (element-with-id linkend))
|
||||||
|
(parent-gi (gi (parent))))
|
||||||
|
(cond
|
||||||
|
;; function names should be plain in FUNCDEF
|
||||||
|
((equal? parent-gi "funcdef")
|
||||||
|
(process-children))
|
||||||
|
|
||||||
|
;; if a valid ID for the target function is not found, or if the
|
||||||
|
;; FUNCTION tag is within the definition of the same function,
|
||||||
|
;; make it bold, add (), but don't make a link
|
||||||
|
((or (node-list-empty? target)
|
||||||
|
(equal? (case-fold-down
|
||||||
|
(data (node-list-first
|
||||||
|
(select-elements
|
||||||
|
(node-list-first
|
||||||
|
(children
|
||||||
|
(select-elements
|
||||||
|
(children
|
||||||
|
(ancestor-member (parent) (list "refentry")))
|
||||||
|
"refnamediv")))
|
||||||
|
"refname"))))
|
||||||
|
command-name))
|
||||||
|
($bold-seq$
|
||||||
|
(make sequence
|
||||||
|
(literal "{")
|
||||||
|
(process-children)
|
||||||
|
(literal "}"))))
|
||||||
|
|
||||||
|
;; else make a link to the function and add ()
|
||||||
|
(else
|
||||||
|
(make element gi: "A"
|
||||||
|
attributes: (list
|
||||||
|
(list "HREF" (href-to target)))
|
||||||
|
($bold-seq$
|
||||||
|
(make sequence
|
||||||
|
(literal "{")
|
||||||
|
(process-children)
|
||||||
|
(literal "}"))))))))
|
||||||
|
|
||||||
(element classname
|
(element classname
|
||||||
(let* ((class-name (data (current-node)))
|
(let* ((class-name (data (current-node)))
|
||||||
|
Reference in New Issue
Block a user