mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
more linking and WS from Peter
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
It is sometimes desirable or even necessary to have Smarty ignore sections it
|
||||
would otherwise parse. A classic example is embedding Javascript or CSS code in
|
||||
a template. The problem arises as those languages use the { and } characters
|
||||
which are also the default delimiters for Smarty.
|
||||
which are also the default
|
||||
<link linkend="language.function.ldelim">delimiters</link> for Smarty.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@@ -50,7 +51,7 @@ $smarty->display('example.tpl');
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
<script language="javascript">
|
||||
var foo = <!--{$foo}-->;
|
||||
var foo = 'bar';
|
||||
function dosomething() {
|
||||
alert("foo is " + foo);
|
||||
}
|
||||
|
@@ -25,6 +25,10 @@
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
See also <link linkend="language.function.math">{math}</link> function.
|
||||
</para>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
@@ -3,7 +3,8 @@
|
||||
<sect1 id="language.syntax.attributes">
|
||||
<title>Attributes</title>
|
||||
<para>
|
||||
Most of the functions take attributes that specify or modify
|
||||
Most of the <link linkend="language.syntax.functions">functions</link>
|
||||
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
|
||||
@@ -22,14 +23,16 @@
|
||||
<![CDATA[
|
||||
{include file="header.tpl"}
|
||||
|
||||
{include file="header.tpl" attrib_name="attrib value"}
|
||||
|
||||
{include file=$includeFile}
|
||||
|
||||
{include file=#includeFile#}
|
||||
{include file=#includeFile# title="Smarty is cool"}
|
||||
|
||||
{html_select_date display_days=yes}
|
||||
|
||||
<select name="company">
|
||||
{html_options values=$vals selected=$selected output=$output}
|
||||
{html_options options=$choices selected=$selected}
|
||||
</select>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@@ -4,27 +4,38 @@
|
||||
<title>Comments</title>
|
||||
<para>
|
||||
Template comments are surrounded by asterisks, and that is surrounded
|
||||
by the delimiter tags like so: {* this is a comment *}
|
||||
Smarty comments are not displayed in the final output of the template.
|
||||
They are used for making internal notes in the templates.
|
||||
by the
|
||||
<link linkend="variable.left.delimiter"> delimiter</link>
|
||||
tags like so: {* this is a comment *}
|
||||
Smarty comments are NOT displayed in the final output of the template,
|
||||
unlike <!-- HTML comments -->
|
||||
They are useful for making internal notes in the templates.
|
||||
</para>
|
||||
<example>
|
||||
<title>Comments</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* Smarty *}
|
||||
<body>
|
||||
{* this multiline
|
||||
comment is
|
||||
not sent to browser
|
||||
*}
|
||||
|
||||
{* include the header file here *}
|
||||
{include file="header.tpl"}
|
||||
|
||||
|
||||
{* Dev note: $includeFile is assigned foo.php script *}
|
||||
<!-- this html comment is sent to browser -->
|
||||
{include file=$includeFile}
|
||||
|
||||
{include file=#includeFile#}
|
||||
|
||||
{* display dropdown lists *}
|
||||
<select name="company">
|
||||
{html_options values=$vals selected=$selected output=$output}
|
||||
{html_options options=$vals selected=$selected_id}
|
||||
</select>
|
||||
</body>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@@ -6,7 +6,9 @@
|
||||
Each Smarty tag either prints a
|
||||
<link linkend="language.variables">variable</link> or invokes some sort
|
||||
of function. Functions are processed and displayed by enclosing the
|
||||
function and its attributes into delimiters like so: {funcname
|
||||
function and its
|
||||
<link linkend="language.syntax.attributes">attributes</link>
|
||||
into delimiters like so: {funcname
|
||||
attr1="val" attr2="val"}.
|
||||
</para>
|
||||
<example>
|
||||
@@ -30,16 +32,20 @@
|
||||
<para>
|
||||
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
|
||||
have the same syntax within templates.
|
||||
</para>
|
||||
<para>Built-in functions are the
|
||||
<emphasis role="bold">inner</emphasis> workings of Smarty, such as
|
||||
<link linkend="language.function.if">{if}</link>,
|
||||
<link linkend="language.function.section">{section}</link> and
|
||||
<link linkend="language.function.strip">{strip}</link>.
|
||||
They cannot be modified. Custom functions are
|
||||
additional functions implemented via <link linkend="plugins">plugins</link>.
|
||||
They cannot be modified.
|
||||
</para>
|
||||
<para>Custom functions are <emphasis role="bold">additional</emphasis>
|
||||
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">{html_options}</link> and
|
||||
<link linkend="language.function.html.select.date">{html_select_date}</link>
|
||||
<link linkend="language.function.popup">{popup}</link>
|
||||
are examples of custom functions.
|
||||
</para>
|
||||
</sect1>
|
||||
|
@@ -3,7 +3,7 @@
|
||||
<sect1 id="language.syntax.variables">
|
||||
<title>Variables</title>
|
||||
<para>
|
||||
Template variables start with a dollar sign. They can contain numbers,
|
||||
Template variables start with a $dollar sign. They can contain numbers,
|
||||
letters and underscores, much like a
|
||||
<ulink url="&url.php-manual;language.variables">PHP variable</ulink>.
|
||||
You can reference arrays
|
||||
|
@@ -91,7 +91,10 @@
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
See also <link linkend="language.function.eval">{eval}</link>,
|
||||
See also
|
||||
<link
|
||||
linkend="language.variables.smarty.capture">$smarty.capture</link>,
|
||||
<link linkend="language.function.eval">{eval}</link>,
|
||||
<link linkend="language.function.fetch">{fetch}</link>,
|
||||
<link linkend="api.fetch">fetch()</link>
|
||||
and <link linkend="language.function.assign">{assign}</link>.
|
||||
|
@@ -66,18 +66,35 @@
|
||||
<para>
|
||||
{config_load} is used for loading config
|
||||
<link linkend="language.config.variables">#variables#</link> from a
|
||||
configuration file into the template.
|
||||
See <link linkend="config.files">Config Files</link> for more
|
||||
info.
|
||||
<link linkend="config.files">configuration file</link> into the template.
|
||||
</para>
|
||||
<example>
|
||||
<title>{config_load}</title>
|
||||
<para>
|
||||
example.conf
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{config_load file="colors.conf"}
|
||||
#this is config file comment
|
||||
|
||||
# global variables
|
||||
pageTitle = "Main Menu"
|
||||
bodyBgColor = #000000
|
||||
tableBgColor = #000000
|
||||
rowBgColor = #00ff00
|
||||
|
||||
#customer variables section
|
||||
[Customer]
|
||||
pageTitle = "Customer Info"
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>and the template</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{config_load file="example.conf"}
|
||||
|
||||
<html>
|
||||
<title>{#pageTitle#}</title>
|
||||
<title>{#pageTitle#|default:"No title"}</title>
|
||||
<body bgcolor="{#bodyBgColor#}">
|
||||
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
|
||||
<tr bgcolor="{#rowBgColor#}">
|
||||
@@ -95,21 +112,23 @@
|
||||
<link linkend="config.files">Config Files</link>
|
||||
may also contain sections. You can load variables from
|
||||
within a section with the added attribute
|
||||
<emphasis>section</emphasis>.
|
||||
<emphasis>'section'</emphasis>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
<emphasis>Config file sections</emphasis> and the built-in
|
||||
template function called <emphasis>section</emphasis> have nothing
|
||||
template function called
|
||||
<link linkend="language.function.section"><emphasis>{section}</emphasis></link>
|
||||
have nothing
|
||||
to do with each other, they just happen to share a common naming
|
||||
convention.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>function config_load with section</title>
|
||||
<title>function {config_load} with section</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{config_load file="colors.conf" section="Customer"}
|
||||
{config_load file="example.conf" section="Customer"}
|
||||
|
||||
<html>
|
||||
<title>{#pageTitle#}</title>
|
||||
|
@@ -110,20 +110,21 @@
|
||||
// The key contains the key for each looped value
|
||||
// assignment looks like this:
|
||||
<?php
|
||||
$smarty->assign("contacts", array(
|
||||
array("phone" => "1",
|
||||
"fax" => "2",
|
||||
"cell" => "3"),
|
||||
array("phone" => "555-4444",
|
||||
"fax" => "555-3333",
|
||||
"cell" => "760-1234"))
|
||||
);
|
||||
$smarty->assign('contacts', array(
|
||||
array('phone' => '1',
|
||||
'fax' => '2',
|
||||
'cell' => '3'),
|
||||
array('phone' => '555-4444',
|
||||
'fax' => '555-3333',
|
||||
'cell' => '760-1234')
|
||||
));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{foreach name=outer item=contact from=$contacts}
|
||||
<hr />
|
||||
{foreach key=key item=item from=$contact}
|
||||
{$key}: {$item}<br />
|
||||
{/foreach}
|
||||
@@ -135,9 +136,11 @@
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
<hr />
|
||||
phone: 1<br />
|
||||
fax: 2<br />
|
||||
cell: 3<br />
|
||||
<hr />
|
||||
phone: 555-4444<br />
|
||||
fax: 555-3333<br />
|
||||
cell: 760-1234<br />
|
||||
@@ -174,6 +177,10 @@
|
||||
attribute of foreach
|
||||
</para>
|
||||
|
||||
<para>See <link linkend="section.property.index">{section}</link>
|
||||
for examples of the properties below as they are identical
|
||||
</para>
|
||||
|
||||
<sect2 id="foreach.property.iteration">
|
||||
<title>iteration</title>
|
||||
<para>
|
||||
@@ -220,6 +227,7 @@
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
|
@@ -3,7 +3,8 @@
|
||||
<sect1 id="language.function.if">
|
||||
<title>{if},{elseif},{else}</title>
|
||||
<para>
|
||||
<emphasis>{if}</emphasis> statements in Smarty have much the same flexibility as PHP if
|
||||
<emphasis>{if}</emphasis> statements in Smarty have much the same flexibility as PHP
|
||||
<ulink url="&url.php-manual;if"><command>if</command></ulink>
|
||||
statements, with a few added features for the template engine.
|
||||
Every <emphasis>{if}</emphasis> must be paired with an
|
||||
<emphasis>{/if}</emphasis>. <emphasis>{else}</emphasis> and
|
||||
@@ -137,7 +138,7 @@
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<example>
|
||||
<title>if statements</title>
|
||||
<title>{if} statements</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{if $name eq "Fred"}
|
||||
@@ -158,8 +159,10 @@
|
||||
...
|
||||
{/if}
|
||||
|
||||
{* the following syntax will NOT work, conditional qualifiers
|
||||
must be separated from surrounding elements by spaces *}
|
||||
{*
|
||||
the following syntax will NOT work, conditional qualifiers
|
||||
must be separated from surrounding elements by spaces
|
||||
*}
|
||||
{if $name=="Fred" || $name=="Wilma"}
|
||||
...
|
||||
{/if}
|
||||
@@ -191,8 +194,10 @@
|
||||
...
|
||||
{/if}
|
||||
|
||||
{* test if var is even, grouped by two. i.e.,
|
||||
0=even, 1=even, 2=odd, 3=odd, 4=even, 5=even, etc. *}
|
||||
{*
|
||||
test if var is even, grouped by two. i.e.,
|
||||
0=even, 1=even, 2=odd, 3=odd, 4=even, 5=even, etc.
|
||||
*}
|
||||
{if $var is even by 2}
|
||||
...
|
||||
{/if}
|
||||
|
@@ -48,28 +48,30 @@
|
||||
<note>
|
||||
<title>Technical Note</title>
|
||||
<para>
|
||||
include_php is pretty much deprecated from Smarty, you can
|
||||
{include_php} is pretty much deprecated from Smarty, you can
|
||||
accomplish the same functionality via a custom template function.
|
||||
The only reason to use include_php is if you really have a need to
|
||||
quarantine the php function away from the plugin directory or your
|
||||
The only reason to use {include_php} is if you really have a need to
|
||||
quarantine the php function away from the
|
||||
<link linkend="variable.plugins.dir">plugins</link>
|
||||
directory or your
|
||||
application code. See the <link
|
||||
linkend="tips.componentized.templates">componentized template
|
||||
example</link> for details.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
include_php tags are used to include a php script in your template.
|
||||
{include_php} tags are used to include a php script in your template.
|
||||
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
|
||||
The {include_php} tag must have the attribute
|
||||
"file", which contains the path to the included php file, either
|
||||
relative to
|
||||
<link linkend="variable.trusted.dir">$trusted_dir</link>,
|
||||
or an absolute path.
|
||||
</para>
|
||||
<para>
|
||||
include_php is a nice way to handle <link
|
||||
{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
|
||||
@@ -89,7 +91,7 @@
|
||||
<para>
|
||||
You can optionally pass the <emphasis>assign</emphasis> attribute,
|
||||
which will specify a template variable name that the output of
|
||||
<emphasis>include_php</emphasis> will be assigned to instead of
|
||||
<emphasis>{include_php}</emphasis> will be assigned to instead of
|
||||
displayed.
|
||||
</para>
|
||||
<para>
|
||||
@@ -97,12 +99,10 @@
|
||||
include.
|
||||
</para>
|
||||
<example>
|
||||
<title>function include_php</title>
|
||||
<programlisting>
|
||||
<title>function {include_php}</title>
|
||||
<para>load_nav.php</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
load_nav.php
|
||||
-------------
|
||||
|
||||
<?php
|
||||
|
||||
// load in variables from a mysql db and assign them to the template
|
||||
@@ -115,7 +115,7 @@
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Where index.pl is:
|
||||
Where index.tpl is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
@@ -51,20 +51,28 @@
|
||||
the attribute "file", which contains the template resource path.
|
||||
</para>
|
||||
<para>
|
||||
You can optionally pass the <emphasis>assign</emphasis> attribute,
|
||||
You can optionally pass the <emphasis>'assign'</emphasis> attribute,
|
||||
which will specify a template variable name that the output of
|
||||
{include} will be assigned to instead of
|
||||
displayed.
|
||||
</para>
|
||||
<example>
|
||||
<title>function include</title>
|
||||
<title>function {include}</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{include file="header.tpl"}
|
||||
<html>
|
||||
<head>
|
||||
<title>{$title}</title>
|
||||
</head>
|
||||
<body>
|
||||
{include file="page_header.tpl"}
|
||||
|
||||
{* body of template goes here *}
|
||||
{include file="/$tpl_name.tpl"} <-- will replace $tpl_name with value
|
||||
|
||||
{include file="footer.tpl"}
|
||||
{include file="page_footer.tpl"}
|
||||
</body>
|
||||
</html>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
@@ -76,7 +84,7 @@
|
||||
the case they are named alike.
|
||||
</para>
|
||||
<example>
|
||||
<title>function include passing variables</title>
|
||||
<title>{include} passing variables</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{include file="header.tpl" title="Main Menu" table_bgcolor="#c0c0c0"}
|
||||
@@ -84,9 +92,43 @@
|
||||
{* body of template goes here *}
|
||||
|
||||
{include file="footer.tpl" logo="http://my.example.com/logo.gif"}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>where header.tpl could be</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
<table border='1' width='100%' bgcolor='{$table_bgcolor|default:"#0000FF"}'>
|
||||
<tr><td>
|
||||
<h1>{$title}</h1>
|
||||
</td></tr>
|
||||
</table>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
|
||||
<example>
|
||||
<title>{include} and assign to variable</title>
|
||||
<para>This example assign the contents of nav.tpl to a variable
|
||||
and outputs at the top of page and the bottom.
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
<body>
|
||||
{include file="nav.tpl" assign="navbar"}
|
||||
{include file="header.tpl" title="Main Menu" table_bgcolor="#c0c0c0"}
|
||||
{$navbar}
|
||||
|
||||
{* body of template goes here *}
|
||||
|
||||
{include file="footer.tpl" logo="http://my.example.com/logo.gif"}
|
||||
{$navbar}
|
||||
</body>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
|
||||
<para>
|
||||
Use the syntax for <link
|
||||
linkend="template.resources">template resources</link> to
|
||||
@@ -94,7 +136,7 @@
|
||||
directory.
|
||||
</para>
|
||||
<example>
|
||||
<title>function include template resource examples</title>
|
||||
<title>{include} template resource examples</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* absolute filepath *}
|
||||
|
@@ -54,8 +54,8 @@
|
||||
</informaltable>
|
||||
<para>
|
||||
Insert tags work much like <link
|
||||
linkend="language.function.include">include</link> tags,
|
||||
except that insert tags are not cached when you have
|
||||
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>
|
||||
@@ -64,12 +64,13 @@
|
||||
the page. The banner can contain any mixture of HTML, images,
|
||||
flash, etc. so we can't just use a static link here, and we
|
||||
don't want this contents cached with the page. In comes the
|
||||
insert tag: the template knows #banner_location_id# and
|
||||
#site_id# values (gathered from a config file), and needs to
|
||||
{insert} tag: the template knows #banner_location_id# and
|
||||
#site_id# values (gathered from a
|
||||
<link linkend="config.files">config file</link>), and needs to
|
||||
call a function to get the banner contents.
|
||||
</para>
|
||||
<example>
|
||||
<title>function insert</title>
|
||||
<title>function {insert}</title>
|
||||
<programlisting>
|
||||
{* example of fetching a banner *}
|
||||
{insert name="getBanner" lid=#banner_location_id# sid=#site_id#}
|
||||
@@ -80,41 +81,43 @@
|
||||
parameters #banner_location_id# and #site_id#. Smarty will look
|
||||
for a function named insert_getBanner() in your PHP application, passing
|
||||
the values of #banner_location_id# and #site_id# as the first argument
|
||||
in an associative array. All insert function names in
|
||||
in an associative array. All {insert} function names in
|
||||
your application must be prepended with "insert_" to remedy possible
|
||||
function name-space conflicts. Your insert_getBanner() function should
|
||||
do something with the passed values and return the results. These results
|
||||
are then displayed in the template in place of the insert tag.
|
||||
are then displayed in the template in place of the {insert} tag.
|
||||
In this example, Smarty would call this function:
|
||||
insert_getBanner(array("lid" => "12345","sid" => "67890"));
|
||||
and display the returned results in place of the insert tag.
|
||||
and display the returned results in place of the {insert} tag.
|
||||
</para>
|
||||
<para>
|
||||
If you supply the "assign" attribute, the output of the insert tag
|
||||
If you supply the "assign" attribute, the output of the {insert} tag
|
||||
will be assigned to this template variable instead of being output
|
||||
to the template. NOTE: assigning the output to a template variable
|
||||
isn't too useful with caching enabled.
|
||||
isn't too useful with
|
||||
<link linkend="variable.caching">caching</link> enabled.
|
||||
</para>
|
||||
<para>
|
||||
If you supply the "script" attribute, this php script will be
|
||||
included (only once) before the insert function is executed. This
|
||||
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 <link
|
||||
either absolute, or relative to
|
||||
<link linkend="variable.trusted.dir">$trusted_dir</link>. 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
|
||||
can reference and modify information in the Smarty object from
|
||||
within the insert function.
|
||||
within the {insert} function.
|
||||
</para>
|
||||
<note>
|
||||
<title>Technical Note</title>
|
||||
<para>
|
||||
It is possible to have portions of the template not
|
||||
cached. If you have <link linkend="caching">caching</link>
|
||||
turned on, insert tags will not be cached. They will run
|
||||
turned on, {insert} tags will not be cached. They will run
|
||||
dynamically every time the page is created, even within cached
|
||||
pages. This works good for things like banners, polls, live
|
||||
weather, search results, user feedback areas, etc.
|
||||
|
@@ -3,7 +3,9 @@
|
||||
<sect1 id="language.function.ldelim">
|
||||
<title>{ldelim},{rdelim}</title>
|
||||
<para>
|
||||
ldelim and rdelim are used for escaping template delimiters, in our case
|
||||
{ldelim} and {rdelim} are used for
|
||||
<link linkend="language.escaping">escaping</link>
|
||||
template delimiters, by default
|
||||
"{" or "}". You can also use <link
|
||||
linkend="language.function.literal">{literal}{/literal}</link> to escape
|
||||
blocks of text.
|
||||
@@ -11,7 +13,7 @@
|
||||
linkend="language.variables.smarty.ldelim">{$smarty.ldelim}</link>.
|
||||
</para>
|
||||
<example>
|
||||
<title>ldelim, rdelim</title>
|
||||
<title>{ldelim}, {rdelim}</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* this will print literal delimiters out of the template *}
|
||||
|
@@ -5,14 +5,16 @@
|
||||
<para>
|
||||
{literal} tags allow a block of data to be taken literally. This is typically
|
||||
used around javascript or stylesheet blocks where curly braces would
|
||||
interfere with the template delimiter syntax. Anything within
|
||||
interfere with the template
|
||||
<link linkend="variable.left.delimiter">delimiter</link>
|
||||
syntax. Anything within
|
||||
{literal}{/literal} tags is not interpreted, but displayed as-is. If you
|
||||
need template tags embedded in your literal block, consider using <link
|
||||
need template tags embedded in your {literal} block, consider using <link
|
||||
linkend="language.function.ldelim">{ldelim}{rdelim}</link> to escape the
|
||||
individual delimiters instead.
|
||||
</para>
|
||||
<example>
|
||||
<title>literal tags</title>
|
||||
<title>{literal} tags</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{literal}
|
||||
|
@@ -9,8 +9,8 @@
|
||||
is for advanced users only, not normally needed.
|
||||
</para>
|
||||
<example>
|
||||
<title>php tags</title>
|
||||
<programlisting>
|
||||
<title>{php} tags</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
{php}
|
||||
// including a php script directly
|
||||
@@ -20,6 +20,15 @@
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<note>
|
||||
<title>Technical Note</title>
|
||||
<para>
|
||||
To access PHP variables in {php} blocks you may need to use the PHP
|
||||
<ulink url="&url.php-manual;global">global</ulink>
|
||||
keyword.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="variable.php.handling">$php_handling</link>,
|
||||
|
@@ -10,7 +10,7 @@
|
||||
unmanageable templates.
|
||||
</para>
|
||||
<para>
|
||||
Anything within {strip}{/strip} tags in Smarty are stripped of the
|
||||
Anything within {strip}{/strip} tags are stripped of the
|
||||
extra spaces or carriage returns at the beginnings and ends of the
|
||||
lines before they are displayed. This way you can keep your
|
||||
templates readable, and not worry about extra white space causing
|
||||
@@ -25,12 +25,12 @@
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>strip tags</title>
|
||||
<title>{strip} tags</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* the following will be all run into one line upon output *}
|
||||
{strip}
|
||||
<table border=0>
|
||||
<table border='0'>
|
||||
<tr>
|
||||
<td>
|
||||
<A HREF="{$url}">
|
||||
|
@@ -37,11 +37,12 @@
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
{assign} is used for assigning template variables during the execution
|
||||
of the template.
|
||||
{assign} is used for assigning template variables
|
||||
<emphasis role="bold">during the execution
|
||||
of the template</emphasis>.
|
||||
</para>
|
||||
<example>
|
||||
<title>assign</title>
|
||||
<title>{assign}</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{assign var="name" value="Bob"}
|
||||
@@ -58,6 +59,63 @@ The value of $name is Bob.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<title>Accessing {assign} variables from a PHP script.</title>
|
||||
<para>
|
||||
To access {assign} variables from php use
|
||||
<link linkend="api.get.template.vars">get_template_vars()</link>.
|
||||
However, the variables are only available after/during template execution
|
||||
as in the following example
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* index.tpl *}
|
||||
{assign var="foo" value="Smarty"}
|
||||
]]>
|
||||
</programlisting>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// this will output nothing as the template has not been executed
|
||||
echo $smarty->get_template_vars('foo');
|
||||
|
||||
// fetch the template to a dead variable
|
||||
$dead = $smarty->fetch('index.tpl');
|
||||
|
||||
// this will output 'smarty' as the template has been executed
|
||||
echo $smarty->get_template_vars('foo');
|
||||
|
||||
$smarty->assign('foo','Even smarter');
|
||||
|
||||
// this will output 'Even smarter'
|
||||
echo $smarty->get_template_vars('foo');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
|
||||
<para>
|
||||
The following functions can also <emphasis>optionally</emphasis> assign
|
||||
template variables.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<link linkend="language.function.capture">{capture}</link>,
|
||||
<link linkend="language.function.include">{include}</link>,
|
||||
<link linkend="language.function.include.php">{include_php}</link>,
|
||||
<link linkend="language.function.insert">{insert}</link>,
|
||||
<link linkend="language.function.counter">{counter}</link>,
|
||||
<link linkend="language.function.cycle">{cycle}</link>,
|
||||
<link linkend="language.function.eval">{eval}</link>,
|
||||
<link linkend="language.function.fetch">{fetch}</link>,
|
||||
<link linkend="language.function.math">{math}</link>,
|
||||
<link linkend="language.function.textformat">{textformat}</link>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
See also <link linkend="api.assign">assign()</link>
|
||||
and
|
||||
|
@@ -83,7 +83,7 @@
|
||||
<example>
|
||||
<title>{html_options}</title>
|
||||
<para>
|
||||
<emphasis role="bold">Example 2:</emphasis>
|
||||
<emphasis role="bold">Example 1:</emphasis>
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
@@ -118,10 +118,11 @@ $smarty->assign('cust_names', array(
|
||||
<?php
|
||||
|
||||
$smarty->assign('cust_options', array(
|
||||
1001 => 'Joe Schmoe',
|
||||
1002 => 'Jack Smith',
|
||||
1003 => 'Jane Johnson',
|
||||
1004 => 'Charlie Brown'));
|
||||
1000 => 'Joe Schmoe',
|
||||
1001 => 'Jack Smith',
|
||||
1002 => 'Jane Johnson',
|
||||
1003 => 'Charlie Brown')
|
||||
);
|
||||
$smarty->assign('customer_id', 1001);
|
||||
|
||||
?>
|
||||
@@ -161,7 +162,8 @@ where template is:
|
||||
$sql = 'select type_id, types from types order by type';
|
||||
$smarty->assign('types',$db->getAssoc($sql));
|
||||
|
||||
$sql = 'select * from contacts where contact_id=12';
|
||||
$sql = 'select contact_id, name, email, type_id
|
||||
from contacts where contact_id='.$contact_id;
|
||||
$smarty->assign('contact',$db->getRow($sql));
|
||||
|
||||
?>
|
||||
@@ -173,6 +175,7 @@ where the template is:
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
<select name="type_id">
|
||||
<option value='null'>-- none --</option>
|
||||
{html_options name="type" options=$types selected=$contact.type_id}
|
||||
</select>
|
||||
]]>
|
||||
|
@@ -88,7 +88,8 @@ $smarty->assign('cust_names', array(
|
||||
'Joe Schmoe',
|
||||
'Jack Smith',
|
||||
'Jane Johnson',
|
||||
'Charlie Brown'));
|
||||
'Charlie Brown')
|
||||
);
|
||||
$smarty->assign('customer_id', 1001);
|
||||
|
||||
?>
|
||||
@@ -133,7 +134,8 @@ $smarty->assign('cust_names', array(
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
<label for="id_1000"><input type="radio" name="id" value="1000" id="id_1000" />Joe
|
||||
<label for="id_1000">
|
||||
<input type="radio" name="id" value="1000" id="id_1000" />Joe
|
||||
Schmoe</label><br />
|
||||
<label for="id_1001"><input type="radio" name="id" value="1001" id="id_1001"
|
||||
checked="checked" />Jack
|
||||
@@ -154,7 +156,8 @@ Brown</label><br />
|
||||
$sql = 'select type_id, types from types order by type';
|
||||
$smarty->assign('types',$db->getAssoc($sql));
|
||||
|
||||
$sql = 'select * from contacts where contact_id=12';
|
||||
$sql = 'select contact_id, name, email, type_id
|
||||
from contacts where contact_id='.$contact_id;
|
||||
$smarty->assign('contact',$db->getRow($sql));
|
||||
|
||||
?>
|
||||
|
@@ -229,10 +229,9 @@
|
||||
</para>
|
||||
<example>
|
||||
<title>{html_select_date}</title>
|
||||
<para>Template code</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
template code:
|
||||
-------------
|
||||
{html_select_date}
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@@ -39,9 +39,10 @@
|
||||
<para>
|
||||
This formats a date and time into the given
|
||||
<ulink url="&url.php-manual;strftime">strftime()</ulink> format.
|
||||
Dates can be passed to Smarty as unix timestamps, mysql timestamps
|
||||
or any string made up of month day year (parsable by
|
||||
<ulink url="&url.php-manual;strtotime">strtotime()</ulink>).
|
||||
Dates can be passed to Smarty as unix
|
||||
<ulink url="&url.php-manual;function.time">timestamps</ulink>, mysql timestamps
|
||||
or any string made up of month day year, parsable by
|
||||
<ulink url="&url.php-manual;strtotime">strtotime()</ulink>.
|
||||
Designers can then use date_format to have complete control of the
|
||||
formatting of the date. If the date passed to date_format is empty
|
||||
and a second parameter is passed, that will be used as the date to
|
||||
@@ -64,8 +65,8 @@ $smarty->assign('yesterday', strtotime('-1 day'));
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$smarty.now|date_format}
|
||||
{$smarty.now|date_format:"%A, %B %e, %Y"}
|
||||
{$smarty.now|date_format:"%H:%M:%S"}
|
||||
{$smarty.now|date_format:"%D"}
|
||||
{$smarty.now|date_format:"%I:%M %p"}
|
||||
{$yesterday|date_format}
|
||||
{$yesterday|date_format:"%A, %B %e, %Y"}
|
||||
{$yesterday|date_format:"%H:%M:%S"}
|
||||
@@ -77,8 +78,8 @@ $smarty->assign('yesterday', strtotime('-1 day'));
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Feb 6, 2001
|
||||
Tuesday, February 6, 2001
|
||||
14:33:00
|
||||
02/06/01
|
||||
02:33 pm
|
||||
Feb 5, 2001
|
||||
Monday, February 5, 2001
|
||||
14:33:00
|
||||
@@ -86,7 +87,7 @@ Monday, February 5, 2001
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
date_format conversion specifiers:
|
||||
<command>date_format</command> conversion specifiers:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
%a - abbreviated weekday name according to the current locale
|
||||
@@ -113,7 +114,8 @@ Monday, February 5, 2001
|
||||
%D - same as %m/%d/%y
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%e - day of the month as a decimal number, a single digit is preceded by a space (range 1 to 31)
|
||||
%e - day of the month as a decimal number, a single digit is preceded by a space (range 1
|
||||
to 31)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%g - Week-based year within century [00,99]
|
||||
@@ -137,7 +139,8 @@ Monday, February 5, 2001
|
||||
%k - Hour (24-hour clock) single digits are preceded by a blank. (range 0 to 23)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%l - hour as a decimal number using a 12-hour clock, single digits preceeded by a space (range 1 to 12)
|
||||
%l - hour as a decimal number using a 12-hour clock, single digits preceeded by a space
|
||||
(range 1 to 12)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%m - month as a decimal number (range 01 to 12)
|
||||
@@ -149,7 +152,8 @@ Monday, February 5, 2001
|
||||
%n - newline character
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%p - either `am' or `pm' according to the given time value, or the corresponding strings for the
|
||||
%p - either `am' or `pm' according to the given time value, or the corresponding strings
|
||||
for the
|
||||
current locale
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
@@ -171,11 +175,13 @@ Monday, February 5, 2001
|
||||
%u - weekday as a decimal number [1,7], with 1 representing Monday
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%U - week number of the current year as a decimal number, starting with the first Sunday as the first
|
||||
%U - week number of the current year as a decimal number, starting with the first Sunday
|
||||
as the first
|
||||
day of the first week
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%V - The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week
|
||||
%V - The ISO 8601:1988 week number of the current year as a decimal number, range 01 to
|
||||
53, where week
|
||||
1 is the first week that has at least 4 days in the current
|
||||
year, and with Monday as the first day of the week.
|
||||
</para></listitem>
|
||||
@@ -183,7 +189,8 @@ Monday, February 5, 2001
|
||||
%w - day of the week as a decimal, Sunday being 0
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
%W - week number of the current year as a decimal number, starting with the first Monday as the first
|
||||
%W - week number of the current year as a decimal number, starting with the first Monday
|
||||
as the first
|
||||
day of the first week
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
@@ -218,6 +225,7 @@ Monday, February 5, 2001
|
||||
</para>
|
||||
<para>
|
||||
See also <link linkend="language.variables.smarty.now">$smarty.now</link>,
|
||||
<ulink url="&url.php-manual;strftime">php function strftime()</ulink>,
|
||||
<link linkend="language.function.html.select.date">{html_select_date}</link>
|
||||
and <link linkend="tips.dates">date tips</link>.
|
||||
</para>
|
||||
@@ -245,3 +253,4 @@ vi: ts=1 sw=1
|
||||
-->
|
||||
|
||||
|
||||
|
||||
|
@@ -4,12 +4,15 @@
|
||||
<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).
|
||||
depends on what symbol it is prefixed 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
|
||||
for <link linkend="language.syntax.functions">function</link>
|
||||
<link linkend="language.syntax.attributes">attributes</link> and
|
||||
<link linkend="language.modifiers">modifiers</link>, inside conditional expressions,
|
||||
etc. To print a variable, simply enclose it in the
|
||||
<link linkend="variable.left.delimiter">delimiters</link> so that it
|
||||
is the only thing contained between them. Examples:
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
|
@@ -3,28 +3,53 @@
|
||||
<sect1 id="language.assigned.variables">
|
||||
<title>Variables assigned from PHP</title>
|
||||
<para>
|
||||
Variables that are assigned from PHP are referenced by preceding them with
|
||||
a dollar sign <literal>$</literal>. Variables assigned from within the
|
||||
Variables that are
|
||||
<link linkend="api.assign">assigned</link> from PHP are referenced by preceding them with
|
||||
a dollar sign <literal>$</literal>. Variables assigned from within a
|
||||
template with the <link linkend="language.function.assign">{assign}</link>
|
||||
function are also displayed this way.
|
||||
</para>
|
||||
<example>
|
||||
<title>assigned variables</title>
|
||||
<programlisting>
|
||||
<para> php script</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
Hello {$firstname}, glad to see you could make it.
|
||||
<br />
|
||||
Your last login was on {$lastLoginDate}.
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
|
||||
$smarty->assign('firstname', 'Doug');
|
||||
$smarty->assign('lastname', 'Evans');
|
||||
$smarty->assign('meetingPlace', 'New York');
|
||||
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
where the content of index.tpl is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
Hello {$firstname} {$lastname}, glad to see you can make it.
|
||||
<br />
|
||||
{* this will not work as $vars are case sensitive *}
|
||||
This weeks meeting is in {$meetingplace}.
|
||||
{* this will work *}
|
||||
This weeks meeting is in {$meetingPlace}.
|
||||
]]>
|
||||
</programlisting>
|
||||
|
||||
<para>
|
||||
This will output:
|
||||
</para>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Hello Doug, glad to see you could make it.
|
||||
Hello Doug Evans, glad to see you can make it.
|
||||
<br />
|
||||
Your last login was on January 11th, 2001.
|
||||
This weeks meeting is in .
|
||||
This weeks meeting is in New York.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
@@ -40,7 +65,6 @@ Your last login was on January 11th, 2001.
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('Contacts',
|
||||
array('fax' => '555-222-9876',
|
||||
'email' => 'zaphod@slartibartfast.com',
|
||||
@@ -87,12 +111,12 @@ zaphod@slartibartfast.com<br />
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty = new Smarty;
|
||||
$smarty->assign('Contacts',
|
||||
array('555-222-9876',
|
||||
$smarty->assign('Contacts', array(
|
||||
'555-222-9876',
|
||||
'zaphod@slartibartfast.com',
|
||||
array('555-444-3333',
|
||||
'555-111-1234')));
|
||||
'555-111-1234')
|
||||
));
|
||||
$smarty->display('index.tpl');
|
||||
|
||||
?>
|
||||
|
@@ -89,10 +89,14 @@ rowBgColor = "#cccccc"
|
||||
<para>
|
||||
Config file variables cannot be used until
|
||||
after they are loaded in from a config file. This procedure is
|
||||
explained later in this document under <link linkend="api.config.load"><command>config_load</command></link>.
|
||||
explained later in this document under
|
||||
<link linkend="language.function.config.load"><command>{config_load}</command></link>.
|
||||
</para>
|
||||
<para>
|
||||
See also <link linkend="language.syntax.variables">Variables</link> and
|
||||
<link linkend="language.variables.smarty">$smarty reserved
|
||||
variables</link>
|
||||
</para>
|
||||
<para>See also <link linkend="language.syntax.variables">Variables</link> and <link linkend="language.variables.smarty">$smarty reserved
|
||||
variables</link></para>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="language.variables.smarty">
|
||||
<title>{$smarty} reserved variables</title>
|
||||
<title>{$smarty} reserved variable</title>
|
||||
<para>
|
||||
The reserved {$smarty} variable can be used to access several
|
||||
special template variables. The full list of them follows.
|
||||
@@ -10,9 +10,9 @@
|
||||
<sect2 id="language.variables.smarty.request">
|
||||
<title>Request variables</title>
|
||||
<para>
|
||||
The request variables such as get, post, cookies, server,
|
||||
environment, and session variables can be accessed as demonstrated
|
||||
in the examples below:
|
||||
The <ulink url="&url.php-manual;reserved.variables">request variables
|
||||
</ulink> such as $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV and $_SESSION
|
||||
can be accessed as demonstrated in the examples below:
|
||||
</para>
|
||||
<example>
|
||||
<title>displaying request variables</title>
|
||||
@@ -44,7 +44,7 @@
|
||||
<note>
|
||||
<para>
|
||||
For historical reasons {$SCRIPT_NAME} can be accessed
|
||||
directly though {$smarty.server.SCRIPT_NAME} is the
|
||||
directly, although {$smarty.server.SCRIPT_NAME} is the
|
||||
proposed way to access this value.
|
||||
</para>
|
||||
</note>
|
||||
@@ -53,10 +53,12 @@
|
||||
<sect2 id="language.variables.smarty.now">
|
||||
<title>{$smarty.now}</title>
|
||||
<para>
|
||||
The current timestamp can be accessed with {$smarty.now}. The
|
||||
number reflects the number of seconds passed since the so-called
|
||||
Epoch (January 1, 1970) and can be passed directly to
|
||||
<link linkend="language.modifier.date.format">date_format</link> modifier for display purposes.
|
||||
The current <ulink url="&url.php-manual;function.time">timestamp</ulink>
|
||||
can be accessed with {$smarty.now}. The number reflects the number of
|
||||
seconds passed since the so-called Epoch (January 1, 1970)
|
||||
and can be passed directly to the
|
||||
<link linkend="language.modifier.date.format">date_format</link>
|
||||
modifier for display purposes.
|
||||
</para>
|
||||
<example>
|
||||
<title>using {$smarty.now}</title>
|
||||
@@ -169,3 +171,4 @@ vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
|
||||
|
||||
|
@@ -136,7 +136,7 @@
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
Plugin architecture
|
||||
<link linkend="plugins">Plugin</link> architecture
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
@@ -160,24 +160,25 @@
|
||||
upgrade to a new version of Smarty.
|
||||
</para>
|
||||
<example>
|
||||
<title>Smarty library files</title>
|
||||
<title>Required Smarty library files</title>
|
||||
<screen>
|
||||
<![CDATA[
|
||||
Smarty.class.php
|
||||
Smarty_Compiler.class.php
|
||||
Config_File.class.php
|
||||
debug.tpl
|
||||
/internals/*.php (all of them)
|
||||
/libs/*.php (all of them)
|
||||
/plugins/*.php (all of them)
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
<para>
|
||||
Smarty uses a PHP constant named <link
|
||||
linkend="constant.smarty.dir">SMARTY_DIR</link> which is the system
|
||||
filepath Smarty library directory. Basically, if your application can find
|
||||
the <filename>Smarty.class.php</filename> file, you do not need to set
|
||||
SMARTY_DIR, Smarty will figure it out on its own. Therefore, if
|
||||
Smarty uses a PHP constant named
|
||||
<link linkend="constant.smarty.dir">SMARTY_DIR</link> which is the system
|
||||
file path to the Smarty 'libs/' directory. Basically, if your application
|
||||
can find the <filename>Smarty.class.php</filename> file, you do not need
|
||||
to set <link linkend="constant.smarty.dir">SMARTY_DIR</link>
|
||||
Smarty will figure it out on its own. Therefore, if
|
||||
<filename>Smarty.class.php</filename> is not in your include_path, or you
|
||||
do not supply an absolute path to it in your application, then you must
|
||||
define SMARTY_DIR manually. SMARTY_DIR <emphasis>must</emphasis> include a
|
||||
@@ -247,11 +248,15 @@ $smarty = new Smarty;
|
||||
|
||||
<para>
|
||||
Now that the library files are in place, it's time to setup the Smarty
|
||||
directories for your application. Smarty requires four directories which
|
||||
are (by default) named <filename class="directory">templates</filename>,
|
||||
<filename class="directory">templates_c</filename>, <filename
|
||||
class="directory">configs</filename> and <filename
|
||||
class="directory">cache</filename>. Each of these are definable by the
|
||||
directories for your application.</para>
|
||||
<para>
|
||||
Smarty requires four directories which
|
||||
are (by default) named <filename class="directory">'templates/'</filename>,
|
||||
<filename class="directory">'templates_c/'</filename>, <filename
|
||||
class="directory">'configs/'</filename> and <filename
|
||||
class="directory">'cache/'</filename>.
|
||||
</para>
|
||||
<para>Each of these are definable by the
|
||||
Smarty class properties
|
||||
<link linkend="variable.template.dir">
|
||||
<varname>$template_dir</varname></link>,
|
||||
@@ -286,19 +291,24 @@ $smarty = new Smarty;
|
||||
<para>
|
||||
You will need as least one file under your document root, and that is the
|
||||
script accessed by the web browser. We will call our script
|
||||
<filename>index.php</filename>, and place it in a subdirectory under the
|
||||
<emphasis>'index.php'</emphasis>, and place it in a subdirectory under the
|
||||
document root called <filename class="directory">/guestbook/</filename>.
|
||||
</para>
|
||||
|
||||
<note>
|
||||
<title>Technical Note</title>
|
||||
<para>
|
||||
It is convenient to setup the web server so that "index.php" can be
|
||||
It is convenient to setup the web server so that 'index.php' can be
|
||||
identified as the default directory index, so if you access
|
||||
"http://www.example.com/guestbook/", the index.php script will be executed
|
||||
without "index.php" in the URL. In Apache you can set this up by adding
|
||||
"index.php" onto the end of your DirectoryIndex setting (separate each
|
||||
entry with a space.)
|
||||
http://www.example.com/guestbook/, the 'index.php' script will be executed
|
||||
without adding 'index.php' to the URL. In Apache you can set this up by adding
|
||||
"index.php" onto the end of your <emphasis>DirectoryIndex</emphasis> setting (separate
|
||||
each entry with a space.) as in the httpd.conf example
|
||||
</para>
|
||||
<para>
|
||||
<emphasis>DirectoryIndex
|
||||
index.htm index.html index.php index.php3 default.html index.cgi
|
||||
</emphasis>
|
||||
</para>
|
||||
</note>
|
||||
|
||||
@@ -328,7 +338,8 @@ $smarty = new Smarty;
|
||||
</example>
|
||||
|
||||
<para>
|
||||
Smarty will need write access to the
|
||||
Smarty will need <emphasis role="bold">write access</emphasis>
|
||||
(windows users please ignore) to the
|
||||
<link linkend="variable.compile.dir">
|
||||
<emphasis>$compile_dir</emphasis></link> and
|
||||
<link linkend="variable.cache.dir">
|
||||
@@ -364,8 +375,8 @@ chmod 770 /web/www.example.com/smarty/guestbook/cache/
|
||||
</note>
|
||||
|
||||
<para>
|
||||
We need to create the index.tpl file that Smarty will load. This will be
|
||||
located in your $template_dir.
|
||||
We need to create the 'index.tpl' file that Smarty will load. This will be
|
||||
located in your <link linkend="variable.template.dir">$template_dir</link>.
|
||||
</para>
|
||||
|
||||
<example>
|
||||
@@ -383,7 +394,9 @@ Hello, {$name}!
|
||||
<note>
|
||||
<title>Technical Note</title>
|
||||
<para>
|
||||
{* Smarty *} is a template comment. It is not required, but it is good
|
||||
{* Smarty *} is a template
|
||||
<link linkend="language.syntax.comments">comment</link>.
|
||||
It is not required, but it is good
|
||||
practice to start all your template files with this comment. It makes
|
||||
the file easy to recognize regardless of the file extension. For
|
||||
example, text editors could recognize the file and turn on special
|
||||
@@ -392,8 +405,8 @@ Hello, {$name}!
|
||||
</note>
|
||||
|
||||
<para>
|
||||
Now lets edit index.php. We'll create an instance of Smarty, assign a
|
||||
template variable and display the index.tpl file. In our example
|
||||
Now lets edit 'index.php'. We'll create an instance of Smarty, assign a
|
||||
template variable and display the 'index.tpl' file. In our example
|
||||
environment, "/usr/local/lib/php/Smarty" is in our include_path. Be sure you
|
||||
do the same, or use absolute paths.
|
||||
</para>
|
||||
@@ -553,3 +566,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
|
||||
|
@@ -12,10 +12,12 @@
|
||||
</note>'>
|
||||
|
||||
<!ENTITY parameter.compileid '<para>
|
||||
As an optional third parameter, you can pass a <parameter>compile_id</parameter>.
|
||||
As an optional third parameter, you can pass a
|
||||
<link linkend="variable.compile.id">$compile_id</link>.
|
||||
This is in the event that you want to compile different versions of
|
||||
the same template, such as having separate templates compiled
|
||||
for different languages. Another use for compile_id is when you
|
||||
for different languages. Another use for
|
||||
<link linkend="variable.compile.id">$compile_id</link> is when you
|
||||
use more than one
|
||||
<link linkend="variable.template.dir">$template_dir</link>
|
||||
but only one
|
||||
|
@@ -66,7 +66,7 @@
|
||||
meticulous and overbearing the PHP language may look to the average
|
||||
designer, and this could be masked with a much simpler templating
|
||||
syntax. So what if we combined the two strengths? Thus, Smarty was
|
||||
born...
|
||||
born... :-)
|
||||
</para>
|
||||
</preface>
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="api.functions">
|
||||
<title>Methods</title>
|
||||
<title>Smarty Class Methods()</title>
|
||||
&programmers.api-functions.api-append;
|
||||
&programmers.api-functions.api-append-by-ref;
|
||||
&programmers.api-functions.api-assign;
|
||||
|
@@ -2,11 +2,11 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.append.by.ref">
|
||||
<refnamediv>
|
||||
<refname>append_by_ref</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>append_by_ref()</refname>
|
||||
<refpurpose>append values by reference</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>append_by_ref</methodname>
|
||||
<methodparam><type>string</type><parameter>varname</parameter></methodparam>
|
||||
|
@@ -2,11 +2,11 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.append">
|
||||
<refnamediv>
|
||||
<refname>append</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>append()</refname>
|
||||
<refpurpose>append an element to an assigned array</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>append</methodname>
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
@@ -18,7 +18,7 @@
|
||||
<methodparam choice="opt"><type>bool</type><parameter>merge</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This is used to append an element to an assigned array. If you append
|
||||
If you append
|
||||
to a string value, it is converted to an array value and then
|
||||
appended to. You can explicitly pass name/value pairs, or associative
|
||||
arrays containing the name/value pairs. If you pass the optional third
|
||||
|
@@ -2,18 +2,19 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.assign.by.ref">
|
||||
<refnamediv>
|
||||
<refname>assign_by_ref</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>assign_by_ref()</refname>
|
||||
<refpurpose>assign values by reference</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>assign_by_ref</methodname>
|
||||
<methodparam><type>string</type><parameter>varname</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This is used to assign values to the templates by reference instead of
|
||||
This is used to <link linkend="api.assign">assign()</link>
|
||||
values to the templates by reference instead of
|
||||
making a copy. See the PHP manual on variable referencing for an explanation.
|
||||
</para>
|
||||
<note>
|
||||
@@ -29,7 +30,7 @@
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>assign_by_ref</title>
|
||||
<title>assign_by_ref()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
@@ -2,11 +2,11 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.assign">
|
||||
<refnamediv>
|
||||
<refname>assign</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>assign()</refname>
|
||||
<refpurpose>assign values to the templates</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>assign</methodname>
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
@@ -17,12 +17,11 @@
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This is used to assign values to the templates. You can
|
||||
explicitly pass name/value pairs, or associative arrays
|
||||
You can explicitly pass name/value pairs, or associative arrays
|
||||
containing the name/value pairs.
|
||||
</para>
|
||||
<example>
|
||||
<title>assign</title>
|
||||
<title>assign()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -32,17 +31,42 @@ $smarty->assign('Address', $address);
|
||||
|
||||
// passing an associative array
|
||||
$smarty->assign(array('city' => 'Lincoln', 'state' => 'Nebraska'));
|
||||
|
||||
// passing a row from a database (eg adodb)
|
||||
$sql = 'select id, name, email from contacts where contact ='.$id;
|
||||
$smarty->assign('contact', $db->getRow($sql));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Access these in the template with
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$Name}
|
||||
{$Address}
|
||||
{$city}
|
||||
{$state}
|
||||
|
||||
{$contact.id}, {$contact.name},{$contact.email}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also <link linkend="api.assign.by.ref">assign_by_ref()</link>,
|
||||
<link linkend="api.clear.assign">clear_assign()</link>,
|
||||
<link linkend="api.append">append()</link>,
|
||||
<link linkend="language.function.assign">{assign}</link>,
|
||||
For more complex array assignments see
|
||||
<link linkend="language.function.foreach">{foreach}</link>
|
||||
and
|
||||
<link linkend="api.get.template.vars">get_template_vars()</link>
|
||||
<link linkend="language.function.section">{section}</link>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
See also <link linkend="api.assign.by.ref">assign_by_ref()</link>,
|
||||
<link linkend="api.get.template.vars">get_template_vars()</link>,
|
||||
<link linkend="api.clear.assign">clear_assign()</link>,
|
||||
<link linkend="api.append">append()</link>
|
||||
and
|
||||
<link linkend="language.function.assign">{assign}</link>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -2,25 +2,33 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.clear.all.assign">
|
||||
<refnamediv>
|
||||
<refname>clear_all_assign</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>clear_all_assign()</refname>
|
||||
<refpurpose>clears the values of all assigned variables</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>clear_all_assign</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This clears the values of all assigned variables.
|
||||
</para>
|
||||
<example>
|
||||
<title>clear_all_assign</title>
|
||||
<title>clear_all_assign()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// passing name/value pairs
|
||||
$smarty->assign('Name', 'Fred');
|
||||
$smarty->assign('Address', $address);
|
||||
|
||||
// will output above
|
||||
print_r( $smarty->get_template_vars() );
|
||||
|
||||
// clear all assigned variables
|
||||
$smarty->clear_all_assign();
|
||||
|
||||
// will output nothing
|
||||
print_r( $smarty->get_template_vars() );
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
@@ -2,17 +2,17 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.clear.all.cache">
|
||||
<refnamediv>
|
||||
<refname>clear_all_cache</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>clear_all_cache()</refname>
|
||||
<refpurpose>clears the entire template cache</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>clear_all_cache</methodname>
|
||||
<methodparam choice="opt"><type>int</type><parameter>expire_time</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This clears the entire template cache. As an optional
|
||||
As an optional
|
||||
parameter, you can supply a minimum age in seconds the cache
|
||||
files must be before they will get cleared.
|
||||
</para>
|
||||
@@ -29,7 +29,8 @@ $smarty->clear_all_cache();
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.clear.cache">clear_cache()</link>
|
||||
<link linkend="api.clear.cache">clear_cache()</link>,
|
||||
<link linkend="api.is.cached">is_cached()</link>
|
||||
and
|
||||
<link linkend="caching">caching</link>
|
||||
</para>
|
||||
|
@@ -2,29 +2,28 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.clear.assign">
|
||||
<refnamediv>
|
||||
<refname>clear_assign</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>clear_assign()</refname>
|
||||
<refpurpose>clears the value of an assigned variable</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>clear_assign</methodname>
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This clears the value of an assigned variable. This
|
||||
can be a single value, or an array of values.
|
||||
This can be a single value, or an array of values.
|
||||
</para>
|
||||
<example>
|
||||
<title>clear_assign</title>
|
||||
<title>clear_assign()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// clear a single variable
|
||||
$smarty->clear_assign("Name");
|
||||
$smarty->clear_assign('Name');
|
||||
|
||||
// clear multiple variables
|
||||
$smarty->clear_assign(array("Name", "Address", "Zip"));
|
||||
// clears multiple variables
|
||||
$smarty->clear_assign(array('Name', 'Address', 'Zip'));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
@@ -33,6 +32,7 @@ $smarty->clear_assign(array("Name", "Address", "Zip"));
|
||||
See also
|
||||
<link linkend="api.clear.all.assign">clear_all_assign()</link>,
|
||||
<link linkend="api.clear.config">clear_config()</link>,
|
||||
<link linkend="api.get.template.vars">get_template_vars()</link>,
|
||||
<link linkend="api.assign">assign()</link>
|
||||
and <link linkend="api.append">append()</link>
|
||||
</para>
|
||||
|
@@ -2,46 +2,52 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.clear.cache">
|
||||
<refnamediv>
|
||||
<refname>clear_cache</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>clear_cache()</refname>
|
||||
<refpurpose>clears the cache for a specific template</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>clear_cache</methodname>
|
||||
<methodparam><type>string</type><parameter>template</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>cache_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter>
|
||||
</methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>expire_time</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This clears the cache for a specific <parameter>template</parameter>.
|
||||
If you have multiple caches for this template, you can clear a specific
|
||||
If you have <link linkend="caching.multiple.caches">multiple caches</link>
|
||||
for a template, you can clear a specific
|
||||
cache by supplying the <parameter>cache_id</parameter> as the second
|
||||
parameter.
|
||||
You can also pass a <parameter>compile_id</parameter> as a third parameter.
|
||||
You can "group" templates together so they can be removed as a group. See the
|
||||
You can also pass a
|
||||
<link linkend="variable.compile.id"><parameter>$compile_id</parameter></link>
|
||||
as a third parameter.
|
||||
You can <link linkend="caching.groups">"group"</link> templates
|
||||
together so they can be removed as a group. See the
|
||||
<link linkend="caching">caching section</link> for more
|
||||
information. As an optional fourth parameter, you can supply a
|
||||
minimum age in seconds the cache file must be before it will
|
||||
get cleared.
|
||||
</para>
|
||||
<example>
|
||||
<title>clear_cache</title>
|
||||
<title>clear_cache()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// clear the cache for a template
|
||||
$smarty->clear_cache("index.tpl");
|
||||
$smarty->clear_cache('index.tpl');
|
||||
|
||||
// clear the cache for a particular cache id in an multiple-cache template
|
||||
$smarty->clear_cache("index.tpl", "CACHEID");
|
||||
$smarty->clear_cache('index.tpl', 'CACHEID');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.clear.all.cache">clear_all_cache()</link>
|
||||
and
|
||||
<link linkend="caching">caching</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
@@ -66,3 +72,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
|
||||
|
@@ -2,28 +2,31 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.clear.compiled.tpl">
|
||||
<refnamediv>
|
||||
<refname>clear_compiled_tpl</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>clear_compiled_tpl()</refname>
|
||||
<refpurpose>clears the compiled version of the specified template resource</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>clear_compiled_tpl</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>tpl_file</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter>
|
||||
</methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>exp_time</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This clears the compiled version of the specified template
|
||||
resource, or all compiled template files if one is not specified.
|
||||
if you pass a compile_id only the compiled template for this
|
||||
specific compile_id is cleared. if you pass an exp_time, then only
|
||||
If you pass a <link linkend="variable.compile.id">$compile_id</link>
|
||||
only the compiled template for this
|
||||
specific <link linkend="variable.compile.id">$compile_id</link>
|
||||
is cleared. if you pass an exp_time, then only
|
||||
compiled templates older than exp_time seconds are cleared, by
|
||||
default all compiled templates are cleared regardless of their age.
|
||||
This function is for advanced use only, not normally needed.
|
||||
</para>
|
||||
<example>
|
||||
<title>clear_compiled_tpl</title>
|
||||
<title>clear_compiled_tpl()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -58,3 +61,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
|
||||
|
@@ -2,11 +2,11 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.clear.config">
|
||||
<refnamediv>
|
||||
<refname>clear_config</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>clear_config()</refname>
|
||||
<refpurpose>clears assigned config variables</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>clear_config</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>var</parameter></methodparam>
|
||||
@@ -18,7 +18,7 @@
|
||||
supplied, only that variable is cleared.
|
||||
</para>
|
||||
<example>
|
||||
<title>clear_config</title>
|
||||
<title>clear_config()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -33,6 +33,7 @@ $smarty->clear_config('foobar');
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.get.config.vars">get_config_vars()</link>,
|
||||
<link linkend="language.config.variables">config variables</link>,
|
||||
<link linkend="config.files">config files</link>,
|
||||
<link linkend="language.function.config.load">{config_load}</link>,
|
||||
|
@@ -2,11 +2,11 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.config.load">
|
||||
<refnamediv>
|
||||
<refname>config_load</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>config_load()</refname>
|
||||
<refpurpose> loads config file data and assigns it to the template</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>config_load</methodname>
|
||||
<methodparam><type>string</type><parameter>file</parameter></methodparam>
|
||||
@@ -35,7 +35,7 @@
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
<title>config_load</title>
|
||||
<title>config_load()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -51,6 +51,7 @@ $smarty->config_load('my.conf', 'foobar');
|
||||
<para>
|
||||
See also
|
||||
<link linkend="language.function.config.load">{config_load}</link>,
|
||||
<link linkend="api.get.config.vars">get_config_vars()</link>,
|
||||
<link linkend="api.clear.config">clear_config()</link>,
|
||||
and
|
||||
<link linkend="language.config.variables">config variables</link>
|
||||
|
@@ -2,19 +2,22 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.display">
|
||||
<refnamediv>
|
||||
<refname>display</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>display()</refname>
|
||||
<refpurpose>displays the template</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>display</methodname>
|
||||
<methodparam><type>string</type><parameter>template</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>cache_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter>
|
||||
</methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This displays the template. Supply a valid <link
|
||||
This displays the template unlike
|
||||
<link linkend="api.fetch">fetch()</link>.
|
||||
Supply a valid <link
|
||||
linkend="template.resources">template resource</link>
|
||||
type and path. As an optional second parameter, you can pass a
|
||||
$cache id.
|
||||
@@ -23,7 +26,7 @@
|
||||
</para>
|
||||
¶meter.compileid;
|
||||
<example>
|
||||
<title>display</title>
|
||||
<title>display()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -57,24 +60,25 @@ $smarty->display("index.tpl");
|
||||
<para>
|
||||
Use the syntax for <link
|
||||
linkend="template.resources">template resources</link> to
|
||||
display files outside of the $template_dir directory.
|
||||
display files outside of the
|
||||
<link linkend="variable.template.dir">$template_dir</link> directory.
|
||||
</para>
|
||||
<example>
|
||||
<title>function display template resource examples</title>
|
||||
<title>function display() template resource examples</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// absolute filepath
|
||||
$smarty->display("/usr/local/include/templates/header.tpl");
|
||||
$smarty->display('/usr/local/include/templates/header.tpl');
|
||||
|
||||
// absolute filepath (same thing)
|
||||
$smarty->display("file:/usr/local/include/templates/header.tpl");
|
||||
$smarty->display('file:/usr/local/include/templates/header.tpl');
|
||||
|
||||
// windows absolute filepath (MUST use "file:" prefix)
|
||||
$smarty->display("file:C:/www/pub/templates/header.tpl");
|
||||
$smarty->display('file:C:/www/pub/templates/header.tpl');
|
||||
|
||||
// include from template resource named "db"
|
||||
$smarty->display("db:header.tpl");
|
||||
$smarty->display('db:header.tpl');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
@@ -106,3 +110,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
|
||||
|
@@ -2,19 +2,21 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.fetch">
|
||||
<refnamediv>
|
||||
<refname>fetch</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>fetch()</refname>
|
||||
<refpurpose>returns the template output</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>string</type><methodname>fetch</methodname>
|
||||
<methodparam><type>string</type><parameter>template</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>cache_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>$compile_id</parameter>
|
||||
</methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This returns the template output instead of displaying it.
|
||||
This returns the template output instead of
|
||||
<link linkend="api.display">displaying</link> it.
|
||||
Supply a valid <link
|
||||
linkend="template.resources">template resource</link>
|
||||
type and path. As an optional second parameter, you can pass a
|
||||
@@ -22,36 +24,37 @@
|
||||
section</link> for more information.
|
||||
</para>
|
||||
¶meter.compileid;
|
||||
|
||||
<para>
|
||||
<example>
|
||||
<title>fetch</title>
|
||||
<title>fetch()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
include("Smarty.class.php");
|
||||
include('Smarty.class.php');
|
||||
$smarty = new Smarty;
|
||||
|
||||
$smarty->caching = true;
|
||||
|
||||
// only do db calls if cache doesn't exist
|
||||
if(!$smarty->is_cached("index.tpl")) {
|
||||
if(!$smarty->is_cached('index.tpl')) {
|
||||
|
||||
// dummy up some data
|
||||
$address = "245 N 50th";
|
||||
$address = '245 N 50th';
|
||||
$db_data = array(
|
||||
"City" => "Lincoln",
|
||||
"State" => "Nebraska",
|
||||
"Zip" => "68502"
|
||||
'City' => 'Lincoln',
|
||||
'State' => 'Nebraska',
|
||||
'Zip' => '68502'
|
||||
);
|
||||
|
||||
$smarty->assign("Name","Fred");
|
||||
$smarty->assign("Address",$address);
|
||||
$smarty->assign('Name','Fred');
|
||||
$smarty->assign('Address',$address);
|
||||
$smarty->assign($db_data);
|
||||
|
||||
}
|
||||
|
||||
// capture the output
|
||||
$output = $smarty->fetch("index.tpl");
|
||||
$output = $smarty->fetch('index.tpl');
|
||||
|
||||
// do something with $output here
|
||||
|
||||
@@ -61,6 +64,61 @@ echo $output;
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<example>
|
||||
<title>Using fetch() to send an email</title>
|
||||
<para>
|
||||
The email_body.txt template
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
Dear {$contact.name},
|
||||
|
||||
Welcome and thankyou for signing up as a member of our user group,
|
||||
|
||||
Click on the link below to login with your user name of '{$contact.login_id}'
|
||||
so you can post in our forums.
|
||||
|
||||
http://{$smarty.server.SERVER_NAME}/index.php?page=login
|
||||
|
||||
List master
|
||||
Some user group
|
||||
|
||||
{include file="email_disclaimer.txt"}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The email_disclaimer.txt template
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
This e-mail is intended for the addressee shown. It contains information
|
||||
....... etc .......
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
and the php script using the PHP
|
||||
<ulink url="&url.php-manual;function.mail">mail()</ulink> function
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// get contact from database eg using pear or adodb
|
||||
$query = 'select name, email, login_id from contacts where contact_id='.$contact_id;
|
||||
$contact = $db->getRow($sql);
|
||||
$smarty->assign('contact', $contact);
|
||||
|
||||
mail($contact['email'], 'Subject', $smarty->fetch('email_body.txt'));
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="language.function.fetch">{fetch}</link>
|
||||
@@ -92,3 +150,5 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
|
||||
|
||||
|
@@ -2,24 +2,26 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.get.config.vars">
|
||||
<refnamediv>
|
||||
<refname>get_config_vars</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>get_config_vars()</refname>
|
||||
<refpurpose>returns the given loaded config variable value</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_config_vars</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>varname</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This returns the given loaded config variable value. If no parameter
|
||||
is given, an array of all loaded config variables is returned.
|
||||
If no parameter is given, an array of all loaded
|
||||
<link linkend="language.config.variables">config variables</link>
|
||||
is returned.
|
||||
</para>
|
||||
<example>
|
||||
<title>get_config_vars</title>
|
||||
<title>get_config_vars()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// get loaded config template var 'foo'
|
||||
$foo = $smarty->get_config_vars('foo');
|
||||
|
||||
|
@@ -2,22 +2,23 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.get.registered.object">
|
||||
<refnamediv>
|
||||
<refname>get_registered_object</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>get_registered_object()</refname>
|
||||
<refpurpose>returns a reference to a registered object</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_registered_object</methodname>
|
||||
<methodparam><type>string</type><parameter>object_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This returns a reference to a registered object. This is useful
|
||||
This is useful
|
||||
from within a custom function when you need direct access to a
|
||||
registered object.
|
||||
<link linkend="api.register.object">registered object</link>. See
|
||||
<link linkend="advanced.features.objects">objects</link> for more info.
|
||||
</para>
|
||||
<example>
|
||||
<title>get_registered_object</title>
|
||||
<title>get_registered_object()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -33,6 +34,13 @@ function smarty_block_foo($params, &$smarty)
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.register.object">register_object()</link>,
|
||||
<link linkend="api.unregister.object">unregister_object()</link>
|
||||
and
|
||||
<link linkend="advanced.features.objects">objects section</link>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -2,18 +2,19 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.get.template.vars">
|
||||
<refnamediv>
|
||||
<refname>get_template_vars</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>get_template_vars()</refname>
|
||||
<refpurpose>returns assigned variable value(s)</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>array</type><methodname>get_template_vars</methodname>
|
||||
<methodparam choice="opt"><type>string</type><parameter>varname</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This returns the given assigned variable value. If no parameter
|
||||
is given, an array of all assigned variables is returned.
|
||||
If no parameter
|
||||
is given, an array of all <link linkend="api.assign">assigned</link>
|
||||
variables are returned.
|
||||
</para>
|
||||
<example>
|
||||
<title>get_template_vars</title>
|
||||
@@ -35,7 +36,10 @@ print_r($tpl_vars);
|
||||
<para>
|
||||
See also <link linkend="api.assign">assign()</link>,
|
||||
<link linkend="language.function.assign">{assign}</link>,
|
||||
<link linkend="api.clear.assign">clear_assign()</link>
|
||||
<link linkend="api.assign.by.ref">assign_by_ref()</link>,
|
||||
<link linkend="api.append">append()</link>,
|
||||
<link linkend="api.clear.assign">clear_assign()</link>,
|
||||
<link linkend="api.clear.all.assign">clear_all_assign()</link>
|
||||
and
|
||||
<link linkend="api.get.config.vars">get_config_vars()</link>
|
||||
</para>
|
||||
|
@@ -2,41 +2,44 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.is.cached">
|
||||
<refnamediv>
|
||||
<refname>is_cached</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>is_cached()</refname>
|
||||
<refpurpose>returns true if there is a valid cache for this template</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>is_cached</methodname>
|
||||
<methodparam><type>string</type><parameter>template</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>cache_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter>
|
||||
</methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This returns &true; if there is a valid cache for this template.
|
||||
This only works if <link
|
||||
linkend="variable.caching">$caching</link> is set to true.
|
||||
linkend="variable.caching">$caching</link> is set to true. See also the
|
||||
<link linkend="caching">caching section</link>.
|
||||
</para>
|
||||
<example>
|
||||
<title>is_cached</title>
|
||||
<title>is_cached()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->caching = true;
|
||||
|
||||
if(!$smarty->is_cached("index.tpl")) {
|
||||
if(!$smarty->is_cached('index.tpl')) {
|
||||
// do database calls, assign vars here
|
||||
}
|
||||
|
||||
$smarty->display("index.tpl");
|
||||
$smarty->display('index.tpl');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
You can also pass a $cache id as an optional second parameter
|
||||
in case you want multiple caches for the given template.
|
||||
in case you want
|
||||
<link linkend="caching.multiple.caches">multiple caches</link>
|
||||
for the given template.
|
||||
</para>
|
||||
<para>
|
||||
You can supply a
|
||||
@@ -46,21 +49,22 @@ $smarty->display("index.tpl");
|
||||
<link linkend="variable.compile.id">$compile_id</link> is used.
|
||||
</para>
|
||||
<para>
|
||||
If you do not want to pass a cache id but want to pass a compile
|
||||
id you have to pass <literal>null</literal> as cache id.
|
||||
If you do not want to pass a cache id but want to pass a
|
||||
<link linkend="variable.compile.id">$compile_id</link>
|
||||
you have to pass <emphasis>null</emphasis> as cache id.
|
||||
</para>
|
||||
<example>
|
||||
<title>is_cached with multiple-cache template</title>
|
||||
<title>is_cached() with multiple-cache template</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->caching = true;
|
||||
|
||||
if(!$smarty->is_cached("index.tpl", "FrontPage")) {
|
||||
if(!$smarty->is_cached('index.tpl', 'FrontPage')) {
|
||||
// do database calls, assign vars here
|
||||
}
|
||||
|
||||
$smarty->display("index.tpl", "FrontPage");
|
||||
$smarty->display('index.tpl', 'FrontPage');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
@@ -70,19 +74,29 @@ $smarty->display("index.tpl", "FrontPage");
|
||||
<note>
|
||||
<title>Technical Note</title>
|
||||
<para>
|
||||
If <literal>is_cached</literal> returns true it actually loads the
|
||||
If <literal>is_cached()</literal> returns true it actually loads the
|
||||
cached output and stores it internally. Any subsequent call to
|
||||
<link linkend="api.display">display()</link> or
|
||||
<link linkend="api.fetch">fetch()</link>
|
||||
will return this internally stored output and does not try to reload
|
||||
the cache file. This prevents a race condition that may occur when a
|
||||
second process clears the cache between the calls to is_cached and to
|
||||
display in the example above. This also means calls to
|
||||
second process clears the cache between the calls to is_cached() and to
|
||||
<link linkend="api.display">display()</link>
|
||||
in the example above. This also means calls to
|
||||
<link linkend="api.clear.cache">clear_cache()</link>
|
||||
and other changes of the cache-settings may have no effect after
|
||||
is_cached() returned true.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.clear.cache">clear_cache()</link>,
|
||||
<link linkend="api.clear.all.cache">clear_all_cache()</link>,
|
||||
and
|
||||
<link linkend="caching">caching section</link>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
@@ -105,3 +119,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
|
||||
|
@@ -2,18 +2,18 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.load.filter">
|
||||
<refnamediv>
|
||||
<refname>load_filter</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>load_filter()</refname>
|
||||
<refpurpose>load a filter plugin</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>load_filter</methodname>
|
||||
<methodparam><type>string</type><parameter>type</parameter></methodparam>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function can be used to load a filter plugin. The first
|
||||
The first
|
||||
argument specifies the type of the filter to load and can be one
|
||||
of the following: 'pre', 'post', or 'output'. The second argument
|
||||
specifies the name of the filter plugin, for example, 'trim'.
|
||||
@@ -23,13 +23,28 @@
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->load_filter('pre', 'trim'); // load prefilter named 'trim'
|
||||
$smarty->load_filter('pre', 'datefooter'); // load another prefilter named 'datefooter'
|
||||
$smarty->load_filter('output', 'compress'); // load output filter named 'compress'
|
||||
|
||||
// load prefilter named 'trim'
|
||||
$smarty->load_filter('pre', 'trim');
|
||||
|
||||
// load another prefilter named 'datefooter'
|
||||
$smarty->load_filter('pre', 'datefooter');
|
||||
|
||||
// load output filter named 'compress'
|
||||
$smarty->load_filter('output', 'compress');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.register.prefilter">register_prefilter()</link>,
|
||||
<link linkend="api.register.postfilter">register_postfilter()</link>,
|
||||
<link linkend="api.register.outputfilter">register_outputfilter()</link>
|
||||
and
|
||||
<link linkend="advanced.features">Advanced features</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -2,11 +2,11 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.register.block">
|
||||
<refnamediv>
|
||||
<refname>register_block</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>register_block()</refname>
|
||||
<refpurpose>dynamically register block functions plugins</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>register_block</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
@@ -15,7 +15,8 @@
|
||||
<methodparam><type>mixed</type><parameter>cache_attrs</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Use this to dynamically register block functions plugins.
|
||||
Use this to dynamically register
|
||||
<link linkend="plugins.block.functions">block functions plugins</link>.
|
||||
Pass in the block function name, followed by the PHP
|
||||
function callback that implements it.
|
||||
</para>
|
||||
@@ -38,11 +39,11 @@
|
||||
on how to use them properly.
|
||||
</para>
|
||||
<example>
|
||||
<title>register_block</title>
|
||||
<title>register_block()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->register_block("translate", "do_translation");
|
||||
$smarty->register_block('translate', 'do_translation');
|
||||
|
||||
function do_translation ($params, $content, &$smarty, &$repeat)
|
||||
{
|
||||
@@ -67,6 +68,14 @@ Hello, world!
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.unregister.block">unregister_block()</link>
|
||||
and
|
||||
<link linkend="plugins.block.functions">Plugin Block Functions</link>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -2,11 +2,11 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.register.compiler.function">
|
||||
<refnamediv>
|
||||
<refname>register_compiler_function</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>register_compiler_function()</refname>
|
||||
<refpurpose>dynamically register a compiler function plugin</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>register_compiler_function</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
@@ -14,17 +14,22 @@
|
||||
<methodparam><type>bool</type><parameter>cacheable</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Use this to dynamically register a compiler function plugin.
|
||||
Pass in the compiler function name, followed by the PHP
|
||||
function that implements it.
|
||||
Pass in the
|
||||
<link linkend="plugins.compiler.functions">compiler function</link> name,
|
||||
followed by the PHP function that implements it.
|
||||
</para>
|
||||
<para>
|
||||
The php-function callback <parameter>impl</parameter> can be either (a) a string
|
||||
containing the function name or (b) an array of the form
|
||||
<literal>array(&$object, $method)</literal> with
|
||||
The php-function callback <parameter>impl</parameter> can be either:
|
||||
</para>
|
||||
<para>
|
||||
(a) a string containing the function name
|
||||
</para>
|
||||
<para>(b) an array of the form <literal>array(&$object, $method)</literal> with
|
||||
<literal>&$object</literal> being a reference to an
|
||||
object and <literal>$method</literal> being a string
|
||||
containing the mehod-name or (c) an array of the form
|
||||
containing the mehod-name
|
||||
</para>
|
||||
<para>(c) an array of the form
|
||||
<literal>array(&$class, $method)</literal> with
|
||||
<literal>$class</literal> being a classname and
|
||||
<literal>$method</literal> being a class method of that
|
||||
@@ -35,6 +40,16 @@
|
||||
most cases. See <link linkend="caching.cacheable">Controlling
|
||||
Cacheability of Plugins' Output</link> on how to it properly.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link
|
||||
linkend="api.unregister.compiler.function">unregister_compiler_function()
|
||||
</link>
|
||||
and
|
||||
<link linkend="plugins.compiler.functions">Plugin Compiler Functions</link>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -2,32 +2,39 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.register.function">
|
||||
<refnamediv>
|
||||
<refname>register_function</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>register_function()</refname>
|
||||
<refpurpose>dynamically register template function plugins</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>register_function</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>impl</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>bool</type><parameter>cacheable</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>mixed</type><parameter>cache_attrs</parameter></methodparam>
|
||||
<methodparam choice="opt"><type>mixed</type><parameter>cache_attrs</parameter>
|
||||
</methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Use this to dynamically register template function plugins.
|
||||
Pass in the template function name, followed by the PHP
|
||||
function name that implements it.
|
||||
Pass in the <link linkend="plugins.functions">template function</link>
|
||||
name, followed by the PHP function name that implements it.
|
||||
</para>
|
||||
<para>
|
||||
The php-function callback <parameter>impl</parameter> can be either (a) a string
|
||||
containing the function name or (b) an array of the form
|
||||
The php-function callback <parameter>impl</parameter> can be either
|
||||
</para>
|
||||
<para>
|
||||
(a) a string containing the function name
|
||||
</para>
|
||||
<para>
|
||||
(b) an array of the form
|
||||
<literal>array(&$object, $method)</literal> with
|
||||
<literal>&$object</literal> being a reference to an
|
||||
object and <literal>$method</literal> being a string
|
||||
containing the mehod-name or (c) an array of the form
|
||||
<literal>array(&$class, $method)</literal> with
|
||||
<literal>$class</literal> being a classname and
|
||||
containing the mehod-name
|
||||
</para>
|
||||
<para>
|
||||
(c) an array of the form <literal>array(&$class, $method)</literal>
|
||||
with <literal>$class</literal> being a classname and
|
||||
<literal>$method</literal> being a class method of that
|
||||
class.
|
||||
</para>
|
||||
@@ -38,11 +45,11 @@
|
||||
on how to use them properly.
|
||||
</para>
|
||||
<example>
|
||||
<title>register_function</title>
|
||||
<title>register_function()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->register_function("date_now", "print_current_date");
|
||||
$smarty->register_function('date_now', 'print_current_date');
|
||||
|
||||
function print_current_date($params)
|
||||
{
|
||||
@@ -53,13 +60,30 @@ function print_current_date($params)
|
||||
return strftime($format,time());
|
||||
}
|
||||
}
|
||||
|
||||
// now you can use this in Smarty to print the current date: {date_now}
|
||||
// or, {date_now format="%Y/%m/%d"} to format it.
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
And in the template
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{date_now}
|
||||
|
||||
{* or to format differently *}
|
||||
{date_now format="%Y/%m/%d"}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.unregister.function">unregister_function()</link>
|
||||
and
|
||||
<link linkend="plugins.functions">Plugin functions</link>
|
||||
.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
@@ -82,3 +106,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
|
||||
|
@@ -2,18 +2,18 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.register.modifier">
|
||||
<refnamediv>
|
||||
<refname>register_modifier</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>register_modifier()</refname>
|
||||
<refpurpose>dynamically register modifier plugin</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>register_modifier</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>impl</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Use this to dynamically register modifier plugin. Pass in the
|
||||
Pass in the
|
||||
template modifier name, followed by the PHP function that it
|
||||
implements it.
|
||||
</para>
|
||||
@@ -30,25 +30,33 @@
|
||||
class.
|
||||
</para>
|
||||
<example>
|
||||
<title>register_modifier</title>
|
||||
<title>register_modifier()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// let's map PHP's stripslashes function to a Smarty modifier.
|
||||
$smarty->register_modifier('sslash', 'stripslashes');
|
||||
|
||||
$smarty->register_modifier("sslash", "stripslashes");
|
||||
|
||||
// now you can use {$var|sslash} to strip slashes from variables
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>template</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
<?php
|
||||
{* use 'sslash' to strip slashes from variables *}
|
||||
{$var|sslash}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.unregister.modifier">unregister_modifier()</link>,
|
||||
<link linkend="api.register.function">register_function()</link>,
|
||||
<link linkend="language.modifiers">modifiers</link>,
|
||||
|
||||
<link linkend="plugins">Extending Smarty with plugins</link>
|
||||
and
|
||||
<link linkend="plugins.modifiers">Plugin modifiers</link>,
|
||||
|
@@ -2,26 +2,27 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.register.object">
|
||||
<refnamediv>
|
||||
<refname>register_object</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>register_object()</refname>
|
||||
<refpurpose>register an object for use in the templates</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>register_object</methodname>
|
||||
<methodparam><type>string</type><parameter>object_name</parameter></methodparam>
|
||||
<methodparam><type>object</type><parameter>object</parameter></methodparam>
|
||||
<methodparam><type>array</type><parameter>allowed_methods_properties</parameter></methodparam>
|
||||
<methodparam><type>array</type><parameter>allowed_methods_properties</parameter>
|
||||
</methodparam>
|
||||
<methodparam><type>boolean</type><parameter>format</parameter></methodparam>
|
||||
<methodparam><type>array</type><parameter>block_methods</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This is to register an object for use in the templates. See the
|
||||
<link linkend="advanced.features.objects">object section</link>
|
||||
of the manual for examples.
|
||||
See the
|
||||
<link linkend="advanced.features.objects">objects section</link>
|
||||
for examples.
|
||||
</para>
|
||||
<para>
|
||||
See Also <link linkend="api.unregister.object">unregister_object()</link>.
|
||||
See also <link linkend="api.unregister.object">unregister_object()</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
@@ -46,3 +47,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
|
||||
|
@@ -2,34 +2,55 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.register.outputfilter">
|
||||
<refnamediv>
|
||||
<refname>register_outputfilter</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>register_outputfilter()</refname>
|
||||
<refpurpose>dynamically register outputfilters</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>register_outputfilter</methodname>
|
||||
<methodparam><type>mixed</type><parameter>function</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Use this to dynamically register outputfilters to operate on
|
||||
a template's output before it is displayed. See
|
||||
Use this to dynamically register
|
||||
<link linkend="plugins.outputfilters">outputfilters</link> to operate on
|
||||
a template's output before it is
|
||||
<link linkend="api.display">displayed</link>. See
|
||||
<link linkend="advanced.features.outputfilters">template output
|
||||
filters</link>
|
||||
for more information on how to set up an output filter function.
|
||||
</para>
|
||||
<para>
|
||||
The php-function callback <parameter>function</parameter> can be either (a) a string
|
||||
containing the function name or (b) an array of the form
|
||||
The php-function callback <parameter>function</parameter> can be either
|
||||
</para>
|
||||
<para>
|
||||
(a) a string
|
||||
containing the function name
|
||||
</para>
|
||||
<para>
|
||||
(b) an array of the form
|
||||
<literal>array(&$object, $method)</literal> with
|
||||
<literal>&$object</literal> being a reference to an
|
||||
object and <literal>$method</literal> being a string
|
||||
containing the mehod-name or (c) an array of the form
|
||||
containing the mehod-name
|
||||
</para>
|
||||
<para>
|
||||
(c) an array of the form
|
||||
<literal>array(&$class, $method)</literal> with
|
||||
<literal>$class</literal> being a classname and
|
||||
<literal>$method</literal> being a class method of that
|
||||
class.
|
||||
</para>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.unregister.outputfilter">unregister_outputfilter()</link>,
|
||||
<link linkend="api.register.prefilter">register_prefilter()</link>,
|
||||
<link linkend="api.register.postfilter">register_postfilter()</link>,
|
||||
<link linkend="api.load.filter">load_filter()</link>,
|
||||
and
|
||||
<link linkend="advanced.features.outputfilters">template
|
||||
output filters</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -2,33 +2,54 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.register.postfilter">
|
||||
<refnamediv>
|
||||
<refname>register_postfilter</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>register_postfilter()</refname>
|
||||
<refpurpose>dynamically register postfilters</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>register_postfilter</methodname>
|
||||
<methodparam><type>mixed</type><parameter>function</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Use this to dynamically register postfilters to run templates
|
||||
Use this to dynamically register
|
||||
<link linkend="advanced.features.postfilters">postfilters</link> to run templates
|
||||
through after they are compiled. See <link
|
||||
linkend="advanced.features.postfilters">template postfilters</link> for
|
||||
more information on how to setup a postfiltering function.
|
||||
</para>
|
||||
<para>
|
||||
The php-function callback <parameter>function</parameter> can be either (a) a string
|
||||
containing the function name or (b) an array of the form
|
||||
The php-function callback <parameter>function</parameter> can be either
|
||||
</para>
|
||||
<para>
|
||||
(a) a string containing the function name
|
||||
</para>
|
||||
<para>
|
||||
(b) an array of the form
|
||||
<literal>array(&$object, $method)</literal> with
|
||||
<literal>&$object</literal> being a reference to an
|
||||
object and <literal>$method</literal> being a string
|
||||
containing the mehod-name or (c) an array of the form
|
||||
containing the mehod-name
|
||||
</para>
|
||||
<para>
|
||||
(c) an array of the form
|
||||
<literal>array(&$class, $method)</literal> with
|
||||
<literal>$class</literal> being a classname and
|
||||
<literal>$method</literal> being a class method of that
|
||||
class.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.unregister.postfilter">unregister_postfilter()</link>,
|
||||
<link linkend="api.register.prefilter">register_prefilter()</link>,
|
||||
<link linkend="api.register.outputfilter">register_ouputfilter()</link>,
|
||||
<link linkend="api.load.filter">load_filter()</link>,
|
||||
and
|
||||
<link linkend="advanced.features.outputfilters">template
|
||||
output filters</link>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -2,32 +2,52 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.register.prefilter">
|
||||
<refnamediv>
|
||||
<refname>register_prefilter</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>register_prefilter()</refname>
|
||||
<refpurpose>dynamically register prefilters</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>register_prefilter</methodname>
|
||||
<methodparam><type>mixed</type><parameter>function</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Use this to dynamically register prefilters to run templates
|
||||
through before they are compiled. See <link
|
||||
Use this to dynamically register
|
||||
<link linkend="advanced.features.prefilters">prefilters</link>
|
||||
to run templates through before they are compiled. See <link
|
||||
linkend="advanced.features.prefilters">template prefilters</link> for
|
||||
more information on how to setup a prefiltering function.
|
||||
</para>
|
||||
<para>
|
||||
The php-function callback <parameter>function</parameter> can be either (a) a string
|
||||
containing the function name or (b) an array of the form
|
||||
The php-function callback <parameter>function</parameter> can be either
|
||||
</para>
|
||||
<para>
|
||||
(a) a string
|
||||
containing the function name
|
||||
</para>
|
||||
<para>
|
||||
(b) an array of the form
|
||||
<literal>array(&$object, $method)</literal> with
|
||||
<literal>&$object</literal> being a reference to an
|
||||
object and <literal>$method</literal> being a string
|
||||
containing the mehod-name or (c) an array of the form
|
||||
containing the mehod-name
|
||||
</para>
|
||||
<para>
|
||||
(c) an array of the form
|
||||
<literal>array(&$class, $method)</literal> with
|
||||
<literal>$class</literal> being a classname and
|
||||
<literal>$method</literal> being a class method of that
|
||||
class.
|
||||
</para>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.unregister.prefilter">unregister_prefilter()</link>,
|
||||
<link linkend="api.register.postfilter">register_postfilter()</link>,
|
||||
<link linkend="api.register.outputfilter">register_ouputfilter()</link>,
|
||||
<link linkend="api.load.filter">load_filter()</link>,
|
||||
and
|
||||
<link linkend="advanced.features.outputfilters">template
|
||||
output filters</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -2,18 +2,20 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.register.resource">
|
||||
<refnamediv>
|
||||
<refname>register_resource</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>register_resource()</refname>
|
||||
<refpurpose>dynamically register resources</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Descrption</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>register_resource</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
<methodparam><type>array</type><parameter>resource_funcs</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Use this to dynamically register a resource plugin with Smarty.
|
||||
Use this to dynamically register a
|
||||
<link linkend="template.resources">resource plugin</link>
|
||||
with Smarty.
|
||||
Pass in the name of the resource and the array of PHP functions
|
||||
implementing it. See
|
||||
<link linkend="template.resources">template resources</link>
|
||||
@@ -40,18 +42,28 @@
|
||||
"secure" and "trusted".
|
||||
</para>
|
||||
<example>
|
||||
<title>register_resource</title>
|
||||
<title>register_resource()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->register_resource("db", array("db_get_template",
|
||||
"db_get_timestamp",
|
||||
"db_get_secure",
|
||||
"db_get_trusted"));
|
||||
$smarty->register_resource('db', array(
|
||||
'db_get_template',
|
||||
'db_get_timestamp',
|
||||
'db_get_secure',
|
||||
'db_get_trusted')
|
||||
);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.unregister.resource">unregister_resource()</link>
|
||||
and
|
||||
<link linkend="template.resources">template resources</link>
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -2,18 +2,17 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.template.exists">
|
||||
<refnamediv>
|
||||
<refname>template_exists</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>template_exists()</refname>
|
||||
<refpurpose>checks whether the specified template exists</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>bool</type><methodname>template_exists</methodname>
|
||||
<methodparam><type>string</type><parameter>template</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This function checks whether the specified template exists. It can
|
||||
accept either a path to the template on the filesystem or a
|
||||
It can accept either a path to the template on the filesystem or a
|
||||
resource string specifying the template.
|
||||
</para>
|
||||
<para>
|
||||
|
@@ -2,11 +2,11 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.trigger.error">
|
||||
<refnamediv>
|
||||
<refname>trigger_error</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>trigger_error()</refname>
|
||||
<refpurpose>output an error message</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>trigger_error</methodname>
|
||||
<methodparam><type>string</type><parameter>error_msg</parameter></methodparam>
|
||||
@@ -15,9 +15,9 @@
|
||||
<para>
|
||||
This function can be used to output an error message using Smarty.
|
||||
<parameter>level</parameter> parameter can be one of the values
|
||||
used for
|
||||
used for the PHP
|
||||
<ulink url="&url.php-manual;trigger_error">trigger_error()</ulink>
|
||||
PHP function, i.e. E_USER_NOTICE,
|
||||
function, i.e. E_USER_NOTICE,
|
||||
E_USER_WARNING, etc. By default it's E_USER_WARNING.
|
||||
</para>
|
||||
<para>
|
||||
|
@@ -2,19 +2,28 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.unregister.block">
|
||||
<refnamediv>
|
||||
<refname>unregister_block</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>unregister_block()</refname>
|
||||
<refpurpose>dynamically unregister block function plugins</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>unregister_block</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Use this to dynamically unregister block function plugin.
|
||||
Use this to dynamically unregister
|
||||
<link linkend="plugins.block.functions">block function plugins</link>.
|
||||
Pass in the block function <parameter>name</parameter>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.register.block">register_block()</link>
|
||||
and
|
||||
<link linkend="plugins.block.functions">Block Functions Plugins</link>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -2,19 +2,29 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.unregister.compiler.function">
|
||||
<refnamediv>
|
||||
<refname>unregister_compiler_function</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>unregister_compiler_function()</refname>
|
||||
<refpurpose>dynamically unregister a compiler function</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>unregister_compiler_function</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Use this to dynamically unregister a compiler function. Pass in
|
||||
Pass in
|
||||
the <parameter>name</parameter> of the compiler function.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link
|
||||
linkend="api.register.compiler.function">register_compiler_function()
|
||||
</link>
|
||||
and
|
||||
<link linkend="plugins.compiler.functions">Plugin Compiler Functions</link>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -3,16 +3,15 @@
|
||||
<refentry id="api.unregister.function">
|
||||
<refnamediv>
|
||||
<refname>unregister_function</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refpurpose>dynamically unregister template function plugin</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>unregister_function</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Use this to dynamically unregister template function plugin.
|
||||
Pass in the template function name.
|
||||
</para>
|
||||
<example>
|
||||
@@ -20,13 +19,22 @@
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// we don't want template designers to have access to system files
|
||||
|
||||
$smarty->unregister_function("fetch");
|
||||
// we don't want template designers to have access to system files
|
||||
$smarty->unregister_function('fetch');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link
|
||||
linkend="api.register.function">register_function()
|
||||
</link>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -2,31 +2,37 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.unregister.modifier">
|
||||
<refnamediv>
|
||||
<refname>unregister_modifier</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>unregister_modifier()</refname>
|
||||
<refpurpose>dynamically unregister modifier plugin</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>unregister_modifier</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Use this to dynamically unregister modifier plugin. Pass in the
|
||||
template modifier name.
|
||||
Pass in the template modifier name.
|
||||
</para>
|
||||
<example>
|
||||
<title>unregister_modifier</title>
|
||||
<title>unregister_modifier()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// we don't want template designers to strip tags from elements
|
||||
|
||||
$smarty->unregister_modifier("strip_tags");
|
||||
// we don't want template designers to strip tags from elements
|
||||
$smarty->unregister_modifier('strip_tags');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.register.modifier">register_modifier()</link>
|
||||
and
|
||||
<link linkend="plugins.modifiers">Plugin modifiers</link>,
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -2,19 +2,22 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.unregister.object">
|
||||
<refnamediv>
|
||||
<refname>unregister_object</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>unregister_object()</refname>
|
||||
<refpurpose>dynamically unregister an object</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>unregister_object</methodname>
|
||||
<methodparam><type>string</type><parameter>object_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
Use this to unregister an object.
|
||||
See also
|
||||
<link linkend="api.register.object">register_object()</link>
|
||||
and
|
||||
<link linkend="advanced.features.objects">objects section</link>
|
||||
</para>
|
||||
<para>See also <link linkend="api.register.object">register_object</link> <link linkend="advanced.features.objects">object section</link></para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -2,11 +2,11 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.unregister.outputfilter">
|
||||
<refnamediv>
|
||||
<refname>unregister_outputfilter</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>unregister_outputfilter()</refname>
|
||||
<refpurpose>dynamically unregister an output filter</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>unregister_outputfilter</methodname>
|
||||
<methodparam><type>string</type><parameter>function_name</parameter></methodparam>
|
||||
@@ -14,6 +14,14 @@
|
||||
<para>
|
||||
Use this to dynamically unregister an output filter.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.register.outputfilter">register_outputfilter()</link>
|
||||
and
|
||||
<link linkend="advanced.features.outputfilters">template
|
||||
output filters</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -2,18 +2,24 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.unregister.postfilter">
|
||||
<refnamediv>
|
||||
<refname>unregister_postfilter</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>unregister_postfilter()</refname>
|
||||
<refpurpose>dynamically unregister a postfilter</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>unregister_postfilter</methodname>
|
||||
<methodparam><type>string</type><parameter>function_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
Use this to dynamically unregister a postfilter.
|
||||
See also
|
||||
<link linkend="api.unregister.postfilter">register_postfilter()</link>
|
||||
and
|
||||
<link linkend="plugins.prefilters.postfilters">template
|
||||
post filters</link>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -2,18 +2,23 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.unregister.prefilter">
|
||||
<refnamediv>
|
||||
<refname>unregister_prefilter</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>unregister_prefilter()</refname>
|
||||
<refpurpose>dynamically unregister a prefilter</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>unregister_prefilter</methodname>
|
||||
<methodparam><type>string</type><parameter>function_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
Use this to dynamically unregister a prefilter.
|
||||
See also
|
||||
<link linkend="api.register.prefilter">register_prefilter()</link>
|
||||
and
|
||||
<link linkend="plugins.prefilters.postfilters">pre filters</link>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -2,29 +2,39 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.unregister.resource">
|
||||
<refnamediv>
|
||||
<refname>unregister_resource</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>unregister_resource()</refname>
|
||||
<refpurpose>dynamically unregister a resource plugin</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>unregister_resource</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Use this to dynamically unregister a resource plugin. Pass in the
|
||||
Pass in the
|
||||
name of the resource.
|
||||
</para>
|
||||
<example>
|
||||
<title>unregister_resource</title>
|
||||
<title>unregister_resource()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->unregister_resource("db");
|
||||
|
||||
$smarty->unregister_resource('db');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.register.resource">register_resource()</link>
|
||||
and
|
||||
<link linkend="template.resources">template resources</link>
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<chapter id="api.variables">
|
||||
<title>Variables</title>
|
||||
<title>Smarty Class Variables</title>
|
||||
|
||||
&programmers.api-variables.variable-template-dir;
|
||||
&programmers.api-variables.variable-compile-dir;
|
||||
|
@@ -6,11 +6,16 @@
|
||||
This is the name of the directory where template caches are
|
||||
stored. By default this is "./cache", meaning that it will look
|
||||
for the cache directory in the same directory as the executing
|
||||
php script. You can also use your own
|
||||
php script.
|
||||
<emphasis role="bold">This directory must
|
||||
be writeable by the web server. </emphasis>
|
||||
You can also use your own
|
||||
<link linkend="section.template.cache.handler.func">
|
||||
custom cache handler</link>
|
||||
function to control cache files, which will ignore this
|
||||
setting.
|
||||
See also
|
||||
<link linkend="variable.use.sub.dirs">$use_sub_dirs</link>.
|
||||
</para>
|
||||
<note>
|
||||
<title>Technical Note</title>
|
||||
@@ -26,6 +31,17 @@
|
||||
the web server document root.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="variable.caching">$caching</link>,
|
||||
<link linkend="variable.use.sub.dirs">$use_sub_dirs</link>,
|
||||
<link linkend="variable.cache.lifetime">$cache_lifetime</link>,
|
||||
<link linkend="variable.cache.handler.func">$cache_handler_func</link>,
|
||||
<link linkend="variable.cache.modified.check">$cache_modified_check</link>
|
||||
and
|
||||
<link linkend="caching">Caching section</link>.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -7,8 +7,20 @@
|
||||
header sent from the client. If the cached file timestamp has
|
||||
not changed since the last visit, then a "304 Not Modified"
|
||||
header will be sent instead of the content. This works only on
|
||||
cached content without <command>insert</command> tags.
|
||||
cached content without
|
||||
<link linkend="language.function.insert"><command>{insert}</command></link>
|
||||
tags.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="variable.caching">$caching</link>,
|
||||
<link linkend="variable.cache.lifetime">$cache_lifetime</link>,
|
||||
<link linkend="variable.cache.handler.func">$cache_handler_func</link>,
|
||||
and
|
||||
<link linkend="caching">Caching section</link>.
|
||||
</para>
|
||||
|
||||
</sect1>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -5,8 +5,9 @@
|
||||
<para>
|
||||
This tells Smarty whether or not to cache the output of the templates.
|
||||
By default this is set to 0, or disabled. If your templates generate
|
||||
redundant redundant content, it is advisable to turn on caching. This
|
||||
will result in significant performance gains. You can also have multiple
|
||||
redundant content, it is advisable to turn on $caching. This
|
||||
will result in significant performance gains. You can also have
|
||||
<link linkend="caching.multiple.caches">multiple</link>
|
||||
caches for the same template. A value of 1 or 2 enables caching. 1 tells
|
||||
Smarty to use the current
|
||||
<link linkend="variable.cache.lifetime">$cache_lifetime</link>
|
||||
@@ -30,6 +31,17 @@
|
||||
is enabled, the cached content will always be
|
||||
regenerated.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="variable.cache.dir">$cache_dir</link>,
|
||||
<link linkend="variable.cache.lifetime">$cache_lifetime</link>,
|
||||
<link linkend="variable.cache.handler.func">$cache_handler_func</link>,
|
||||
<link linkend="variable.cache.modified.check">$cache_modified_check</link>
|
||||
and
|
||||
<link linkend="caching">Caching section</link>.
|
||||
</para>
|
||||
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
|
@@ -7,7 +7,9 @@
|
||||
located. By default this is "./templates_c", meaning that it
|
||||
will look for the compile directory in the same directory as
|
||||
the executing php script. <emphasis role="bold">This directory must
|
||||
be writeable by the web server.</emphasis>
|
||||
be writeable by the web server. </emphasis> See also
|
||||
<link linkend="variable.use.sub.dirs">$use_sub_dirs</link>.
|
||||
|
||||
</para>
|
||||
<note>
|
||||
<title>Technical Note</title>
|
||||
@@ -24,7 +26,9 @@
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
See also <link linkend="variable.compile.id">$compile_id</link>.
|
||||
See also <link linkend="variable.compile.id">$compile_id</link>
|
||||
and
|
||||
<link linkend="variable.use.sub.dirs">$use_sub_dirs</link>.
|
||||
</para>
|
||||
</sect1>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -21,19 +21,23 @@
|
||||
<link linkend="plugins.prefilters.postfilters">prefilter</link>
|
||||
that localizes your templates
|
||||
(that is: translates language dependend parts) at compile time, then
|
||||
you should use the current language as compile_id and you will get a
|
||||
you should use the current language as $compile_id and you will get a
|
||||
set of compiled templates for each language you use.
|
||||
</para>
|
||||
<para>
|
||||
Another example would be to use the same compile directory across
|
||||
multiple domains / multiple vhosts. eg:
|
||||
multiple domains / multiple virtual hosts.
|
||||
</para>
|
||||
<example>
|
||||
<title>compile_id</title>
|
||||
<title>$compile_id</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
$smarty->compile_id = $_SERVER['SERVER_NAME'];
|
||||
$smarty->compile_dir = 'path/to/shared_compile_dir';
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
@@ -3,21 +3,39 @@
|
||||
<sect1 id="variable.use.sub.dirs">
|
||||
<title>$use_sub_dirs</title>
|
||||
<para>
|
||||
Set this to false if your PHP environment does not allow the creation of
|
||||
sub directories by Smarty. Sub directories are more efficient, so use them
|
||||
if you can.
|
||||
Smarty will create subdirectories under the
|
||||
<link linkend="variable.compile.dir">templates_c</link> and
|
||||
<link linkend="variable.cache.dir">cache</link>
|
||||
directories if $use_sub_dirs is set to true.
|
||||
In an environment where there are potentially tens of thousands of files created,
|
||||
this may help the filesystem speed.
|
||||
On the other hand, some environments do not allow PHP processes to
|
||||
create directories, so this must be disabled. The default is false (disabled).
|
||||
Sub directories are more efficient, so use them if you can.
|
||||
</para>
|
||||
<para>
|
||||
Theoretically you get much better perfomance on a filesystem with 10
|
||||
directories each having 100 files, than with 1 directory having 1000
|
||||
files. This was certainly the case with Solaris 7 (UFS)... with newer
|
||||
filesystems such as ext3 and especially reiserfs, the difference is almost
|
||||
nothing.
|
||||
</para>
|
||||
<note>
|
||||
<title>Technical Note</title>
|
||||
<para>
|
||||
$use_sub_dirs=true doesn't work with safe_mode=On, that's why it's
|
||||
switchable and why it's off by default.
|
||||
</para>
|
||||
</note>
|
||||
<note>
|
||||
<title>Note</title>
|
||||
<para>
|
||||
Since Smarty-2.6.2 <varname>$use_sub_dirs</varname> defaults to false.
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
See also <link linkend="variable.template.dir">$template_dir</link>,
|
||||
See also
|
||||
<link linkend="variable.compile.dir">$compile_dir</link>,
|
||||
<link linkend="variable.config.dir">$config_dir</link>,
|
||||
<link linkend="variable.plugins.dir">$plugins_dir</link>
|
||||
and
|
||||
<link linkend="variable.cache.dir">$cache_dir</link>.
|
||||
</para>
|
||||
@@ -42,3 +60,4 @@ vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
<sect1 id="caching.setting.up">
|
||||
<title>Setting Up Caching</title>
|
||||
<para>
|
||||
The first thing to do is enable caching. This is done by setting <link
|
||||
The first thing to do is enable caching by setting <link
|
||||
linkend="variable.caching">$caching</link> = true (or 1.)
|
||||
</para>
|
||||
<example>
|
||||
@@ -49,7 +49,7 @@ $smarty->display('index.tpl');
|
||||
linkend="variable.cache.lifetime">$cache_lifetime</link> for details.
|
||||
</para>
|
||||
<example>
|
||||
<title>setting cache_lifetime per cache</title>
|
||||
<title>setting $cache_lifetime per cache</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
@@ -9,17 +9,24 @@
|
||||
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
|
||||
determine the appropriate value automatically. If defined, the path
|
||||
must end with a slash.
|
||||
<emphasis role="bold">must end with a slash</emphasis>.
|
||||
</para>
|
||||
<example>
|
||||
<title>SMARTY_DIR</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// set path to Smarty directory
|
||||
define("SMARTY_DIR","/usr/local/lib/php/Smarty/");
|
||||
// set path to Smarty directory *nix style
|
||||
define('SMARTY_DIR','/usr/local/lib/php/Smarty/libs/');
|
||||
|
||||
require_once(SMARTY_DIR."Smarty.class.php");
|
||||
// path to Smarty windows style
|
||||
define('SMARTY_DIR','c:/webroot/libs/Smarty/libs/');
|
||||
|
||||
// hack that works on both under DOCUMENT _ROOT (not recommended)
|
||||
define('SMARTY-DIR',str_replace("\\","/",getcwd()).'/includes/Smarty/libs/');
|
||||
|
||||
// include the smarty class Note 'S' is upper case
|
||||
require_once(SMARTY_DIR.'Smarty.class.php');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
@@ -27,13 +34,18 @@ require_once(SMARTY_DIR."Smarty.class.php");
|
||||
<para>
|
||||
See also
|
||||
<link linkend="language.variables.smarty.const">$smarty.const</link>
|
||||
and
|
||||
<link
|
||||
linkend="variable.php.handling">$php_handling constants</link>
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="constant.smarty.core.dir">
|
||||
<title>SMARTY_CORE_DIR</title>
|
||||
<para>
|
||||
This should be the full system path to the location of the Smarty core
|
||||
files. If not defined, Smarty will default this constant to the internals/
|
||||
files. If not defined, Smarty will default this constant to the
|
||||
<emphasis>libs/</emphasis>
|
||||
sub-directory below
|
||||
<link linkend="constant.smarty.dir">SMARTY_DIR</link>.
|
||||
If defined, the path must end with a slash.
|
||||
@@ -44,9 +56,10 @@ require_once(SMARTY_DIR."Smarty.class.php");
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// load core.get_microtime.php
|
||||
|
||||
require_once(SMARTY_CORE_DIR."core.get_microtime.php");
|
||||
// load core.get_microtime.php
|
||||
require_once(SMARTY_CORE_DIR.'core.get_microtime.php');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
|
Reference in New Issue
Block a user