mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 03:14:27 +02:00
Tidy up formatting and examples
This commit is contained in:
@@ -15,13 +15,15 @@
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This is used to
|
||||
<link linkend="api.append">append</link> values to the templates by reference.
|
||||
<link linkend="api.append"><varname>append()</varname></link> values
|
||||
to the templates by reference.
|
||||
If you append a variable by reference then change its
|
||||
value, the appended value sees the change as well. For
|
||||
<link linkend="advanced.features.objects">objects</link>,
|
||||
append_by_ref() also avoids an in-memory copy of the appended object.
|
||||
<varname>append_by_ref()</varname> also avoids an in-memory copy of the
|
||||
appended object.
|
||||
See the PHP manual on variable referencing for an in-depth
|
||||
explanation. If you pass the optional third parameter of true,
|
||||
explanation. If you pass the optional third parameter of &true;,
|
||||
the value will be merged with the current array instead of appended.
|
||||
</para>
|
||||
¬e.parameter.merge;
|
||||
@@ -38,8 +40,11 @@ $smarty->append_by_ref('Address', $address);
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also <link linkend="api.append">append()</link> and
|
||||
<link linkend="api.assign">assign()</link>.
|
||||
See also
|
||||
<link linkend="api.append"><varname>append()</varname></link>,
|
||||
<link linkend="api.assign"><varname>assign()</varname></link>
|
||||
and
|
||||
<link linkend="api.get.template.vars"><varname>get_template_vars()</varname></link>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
@@ -22,7 +22,7 @@ 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
|
||||
parameter of true, the value will be merged with the current array
|
||||
parameter of &true;, the value will be merged with the current array
|
||||
instead of appended.
|
||||
</para>
|
||||
¬e.parameter.merge;
|
||||
@@ -31,9 +31,16 @@ If you append
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// passing name/value pairs
|
||||
$smarty->append("Name", "Fred");
|
||||
$smarty->append("Address", $address);
|
||||
// This is effectively the same as assign()
|
||||
$smarty->append('foo', 'Fred');
|
||||
// After this line, foo will now be seen as an array in the template
|
||||
$smarty->append('foo', 'Albert');
|
||||
|
||||
$array = array(1 => 'one', 2 => 'two');
|
||||
$smarty->append('X', $array);
|
||||
$array2 = array(3 => 'three', 4 => 'four');
|
||||
// The following line will add a second element to the X array
|
||||
$smarty->append('X', $array2);
|
||||
|
||||
// passing an associative array
|
||||
$smarty->append(array('city' => 'Lincoln', 'state' => 'Nebraska'));
|
||||
@@ -42,10 +49,10 @@ $smarty->append(array('city' => 'Lincoln', 'state' => 'Nebraska'));
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>See also
|
||||
<link linkend="api.append.by.ref">append_by_ref()</link>,
|
||||
<link linkend="api.assign">assign()</link>
|
||||
<link linkend="api.append.by.ref"><varname>append_by_ref()</varname></link>,
|
||||
<link linkend="api.assign"><varname>assign()</varname></link>
|
||||
and
|
||||
<link linkend="api.get.template.vars">get_template_vars()</link>
|
||||
<link linkend="api.get.template.vars"><varname>get_template_vars()</varname></link>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -13,7 +13,7 @@
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This is used to <link linkend="api.assign">assign()</link>
|
||||
This is used to <link linkend="api.assign"><varname>assign()</varname></link>
|
||||
values to the templates by reference instead of
|
||||
making a copy. See the PHP manual on variable referencing for an explanation.
|
||||
</para>
|
||||
@@ -24,7 +24,8 @@
|
||||
If you assign a variable by reference then change its
|
||||
value, the assigned value sees the change as well. For
|
||||
<link linkend="advanced.features.objects">objects</link>,
|
||||
assign_by_ref() also avoids an in-memory copy of the assigned object.
|
||||
<varname>assign_by_ref()</varname> also avoids an in-memory copy of the
|
||||
assigned object.
|
||||
See the PHP manual on variable referencing for an in-depth
|
||||
explanation.
|
||||
</para>
|
||||
@@ -42,10 +43,13 @@ $smarty->assign_by_ref('Address', $address);
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also <link linkend="api.assign">assign()</link>,
|
||||
<link linkend="api.clear.all.assign">clear_all_assign()</link>,
|
||||
<link linkend="api.append">append()</link>
|
||||
and <link linkend="language.function.assign">{assign}</link>
|
||||
See also
|
||||
<link linkend="api.assign"><varname>assign()</varname></link>,
|
||||
<link linkend="api.clear.all.assign"><varname>clear_all_assign()</varname></link>,
|
||||
<link linkend="api.append"><varname>append()</varname></link>,
|
||||
<link linkend="language.function.assign"><varname>{assign}</varname></link>
|
||||
and
|
||||
<link linkend="api.get.template.vars"><varname>get_template_vars()</varname></link>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
@@ -32,6 +32,10 @@ $smarty->assign('Address', $address);
|
||||
// passing an associative array
|
||||
$smarty->assign(array('city' => 'Lincoln', 'state' => 'Nebraska'));
|
||||
|
||||
// passing an array
|
||||
$myArray = array('no' => 10, 'label' => 'Peanuts');
|
||||
$smarty->assign('foo',$myArray);
|
||||
|
||||
// passing a row from a database (eg adodb)
|
||||
$sql = 'select id, name, email from contacts where contact ='.$id;
|
||||
$smarty->assign('contact', $db->getRow($sql));
|
||||
@@ -39,7 +43,7 @@ $smarty->assign('contact', $db->getRow($sql));
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Access these in the template with
|
||||
These are accessed in the template with
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
@@ -49,24 +53,26 @@ $smarty->assign('contact', $db->getRow($sql));
|
||||
{$city}
|
||||
{$state}
|
||||
|
||||
{$foo.no}, {$foo.label}
|
||||
{$contact.id}, {$contact.name},{$contact.email}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
For more complex array assignments see
|
||||
<link linkend="language.function.foreach">{foreach}</link>
|
||||
To access more complex array assignments see
|
||||
<link linkend="language.function.foreach"><varname>{foreach}</varname></link>
|
||||
and
|
||||
<link linkend="language.function.section">{section}</link>
|
||||
<link linkend="language.function.section"><varname>{section}</varname></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>
|
||||
See also
|
||||
<link linkend="api.assign.by.ref"><varname>assign_by_ref()</varname></link>,
|
||||
<link linkend="api.get.template.vars"><varname>get_template_vars()</varname></link>,
|
||||
<link linkend="api.clear.assign"><varname>clear_assign()</varname></link>,
|
||||
<link linkend="api.append"><varname>append()</varname></link>
|
||||
and
|
||||
<link linkend="language.function.assign">{assign}</link>
|
||||
<link linkend="language.function.assign"><varname>{assign}</varname></link>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -35,10 +35,11 @@ print_r( $smarty->get_template_vars() );
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.clear.assign">clear_assign()</link>,
|
||||
<link linkend="api.clear.config">clear_config()</link>,
|
||||
<link linkend="api.assign">assign()</link>
|
||||
and <link linkend="api.append">append()</link>
|
||||
<link linkend="api.clear.assign"><varname>clear_assign()</varname></link>,
|
||||
<link linkend="api.clear.config"><varname>clear_config()</varname></link>,
|
||||
<link linkend="api.get.template.vars"><varname>get_template_vars()</varname></link>,
|
||||
<link linkend="api.assign"><varname>assign()</varname></link>
|
||||
and <link linkend="api.append"><varname>append()</varname></link>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -23,16 +23,19 @@
|
||||
<?php
|
||||
// clear the entire cache
|
||||
$smarty->clear_all_cache();
|
||||
|
||||
// clears all files over one hour old
|
||||
$smarty->clear_all_cache(3600);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.clear.cache">clear_cache()</link>,
|
||||
<link linkend="api.is.cached">is_cached()</link>
|
||||
and
|
||||
<link linkend="caching">caching</link>
|
||||
<link linkend="api.clear.cache"><varname>clear_cache()</varname></link>,
|
||||
<link linkend="api.is.cached"><varname>is_cached()</varname></link>
|
||||
and the
|
||||
<link linkend="caching">caching</link> page.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -30,11 +30,11 @@ $smarty->clear_assign(array('Name', 'Address', 'Zip'));
|
||||
</example>
|
||||
<para>
|
||||
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>
|
||||
<link linkend="api.clear.all.assign"><varname>clear_all_assign()</varname></link>,
|
||||
<link linkend="api.clear.config"><varname>clear_config()</varname></link>,
|
||||
<link linkend="api.get.template.vars"><varname>get_template_vars()</varname></link>,
|
||||
<link linkend="api.assign"><varname>assign()</varname></link>
|
||||
and <link linkend="api.append"><varname>append()</varname></link>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -15,21 +15,30 @@
|
||||
</methodparam>
|
||||
<methodparam choice="opt"><type>int</type><parameter>expire_time</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
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.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
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
|
||||
You can <link linkend="caching.groups">group templates together</link>
|
||||
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
|
||||
information.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
As an optional fourth parameter, you can supply a
|
||||
minimum age in seconds the cache file must be before it will
|
||||
get cleared.
|
||||
</para>
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<example>
|
||||
<title>clear_cache()</title>
|
||||
<programlisting role="php">
|
||||
@@ -39,16 +48,16 @@
|
||||
$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', 'MY_CACHE_ID');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.clear.all.cache">clear_all_cache()</link>
|
||||
<link linkend="api.clear.all.cache"><varname>clear_all_cache()</varname></link>
|
||||
and
|
||||
<link linkend="caching">caching</link>.
|
||||
<link linkend="caching"><varname>caching</varname></link> section.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -17,12 +17,13 @@
|
||||
<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 <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.
|
||||
If you pass a
|
||||
<link linkend="variable.compile.id"><parameter>$compile_id</parameter></link>
|
||||
only the compiled template for this specific
|
||||
<link linkend="variable.compile.id"><parameter>$compile_id</parameter></link>
|
||||
is cleared. If you pass an exp_time, then only
|
||||
compiled templates older than <parameter>exp_time</parameter> 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>
|
||||
@@ -31,7 +32,7 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
// clear a specific template resource
|
||||
$smarty->clear_compiled_tpl("index.tpl");
|
||||
$smarty->clear_compiled_tpl('index.tpl');
|
||||
|
||||
// clear entire compile directory
|
||||
$smarty->clear_compiled_tpl();
|
||||
@@ -39,6 +40,9 @@ $smarty->clear_compiled_tpl();
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>See also
|
||||
<link linkend="api.clear.cache"><varname>clear_cache()</varname></link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
@@ -33,13 +33,13 @@ $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>,
|
||||
<link linkend="api.config.load">config_load()</link>
|
||||
<link linkend="api.get.config.vars"><varname>get_config_vars()</varname></link>,
|
||||
<link linkend="language.config.variables"><varname>config variables</varname></link>,
|
||||
<link linkend="config.files"><varname>config files</varname></link>,
|
||||
<link linkend="language.function.config.load"><varname>{config_load}</varname></link>,
|
||||
<link linkend="api.config.load"><varname>config_load()</varname></link>
|
||||
and
|
||||
<link linkend="api.clear.assign">clear_assign()</link>
|
||||
<link linkend="api.clear.assign"><varname>clear_assign()</varname></link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -16,22 +16,24 @@
|
||||
This loads
|
||||
<link linkend="config.files">config file</link>
|
||||
data and assigns it to
|
||||
the template. This works identical to the template <link
|
||||
linkend="language.function.config.load">{config_load}</link>
|
||||
function.
|
||||
the template. This works identically to the template
|
||||
<link linkend="language.function.config.load">
|
||||
<varname>{config_load}</varname></link> function.
|
||||
</para>
|
||||
<note>
|
||||
<title>Technical Note</title>
|
||||
<para>
|
||||
As of Smarty 2.4.0, assigned template variables are kept across
|
||||
invocations of
|
||||
<link linkend="api.fetch">fetch()</link>
|
||||
and <link linkend="api.display">display()</link>.
|
||||
<link linkend="api.fetch"><varname>fetch()</varname></link>
|
||||
and <link linkend="api.display"><varname>display()</varname></link>.
|
||||
Config vars loaded from
|
||||
config_load() are always global scope. Config files are also
|
||||
compiled for faster execution, and respect the <link
|
||||
linkend="variable.force.compile">$force_compile</link> and <link
|
||||
linkend="variable.compile.check">$compile_check</link> settings.
|
||||
<varname>config_load()</varname> are always global in scope.
|
||||
Config files are also compiled for faster execution, and respect the
|
||||
<link linkend="variable.force.compile">
|
||||
<parameter>$force_compile</parameter></link> and
|
||||
<link linkend="variable.compile.check">
|
||||
<parameter>$compile_check</parameter></link> settings.
|
||||
</para>
|
||||
</note>
|
||||
<example>
|
||||
@@ -50,11 +52,11 @@ $smarty->config_load('my.conf', 'foobar');
|
||||
</example>
|
||||
<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>,
|
||||
<link linkend="language.function.config.load"><varname>{config_load}</varname></link>,
|
||||
<link linkend="api.get.config.vars"><varname>get_config_vars()</varname></link>,
|
||||
<link linkend="api.clear.config"><varname>clear_config()</varname></link>,
|
||||
and
|
||||
<link linkend="language.config.variables">config variables</link>
|
||||
<link linkend="language.config.variables"><varname>config variables</varname></link>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -16,13 +16,12 @@
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
This displays the template unlike
|
||||
<link linkend="api.fetch">fetch()</link>.
|
||||
<link linkend="api.fetch"><varname>fetch()</varname></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.
|
||||
See the <link linkend="caching">caching
|
||||
section</link> for more information.
|
||||
<parameter>$cache id</parameter>, see the
|
||||
<link linkend="caching">caching section</link> for more information.
|
||||
</para>
|
||||
¶meter.compileid;
|
||||
<example>
|
||||
@@ -30,12 +29,12 @@
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
include("Smarty.class.php");
|
||||
$smarty = new Smarty;
|
||||
include(SMARTY_DIR.'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";
|
||||
@@ -47,24 +46,26 @@ if(!$smarty->is_cached("index.tpl")) {
|
||||
|
||||
$smarty->assign("Name","Fred");
|
||||
$smarty->assign("Address",$address);
|
||||
$smarty->assign($db_data);
|
||||
$smarty->assign('data', $db_data);
|
||||
|
||||
}
|
||||
|
||||
// display the output
|
||||
$smarty->display("index.tpl");
|
||||
$smarty->display('index.tpl');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
|
||||
<example>
|
||||
<title>Other display() template resource examples</title>
|
||||
<para>
|
||||
Use the syntax for <link
|
||||
linkend="template.resources">template resources</link> to
|
||||
display files outside of the
|
||||
<link linkend="variable.template.dir">$template_dir</link> directory.
|
||||
<link linkend="variable.template.dir">
|
||||
<parameter>$template_dir</parameter></link> directory.
|
||||
</para>
|
||||
<example>
|
||||
<title>function display() template resource examples</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -84,8 +85,8 @@ $smarty->display('db:header.tpl');
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also <link linkend="api.fetch">fetch()</link> and
|
||||
<link linkend="api.template.exists">template_exists()</link>.
|
||||
See also <link linkend="api.fetch"><varname>fetch()</varname></link> and
|
||||
<link linkend="api.template.exists"><varname>template_exists()</varname></link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -20,7 +20,7 @@
|
||||
Supply a valid <link
|
||||
linkend="template.resources">template resource</link>
|
||||
type and path. As an optional second parameter, you can pass a
|
||||
cache id. See the <link linkend="caching">caching
|
||||
<parameter>$cache id</parameter>, see the <link linkend="caching">caching
|
||||
section</link> for more information.
|
||||
</para>
|
||||
¶meter.compileid;
|
||||
@@ -57,7 +57,6 @@ if(!$smarty->is_cached('index.tpl')) {
|
||||
$output = $smarty->fetch('index.tpl');
|
||||
|
||||
// do something with $output here
|
||||
|
||||
echo $output;
|
||||
?>
|
||||
]]>
|
||||
@@ -69,7 +68,7 @@ echo $output;
|
||||
<example>
|
||||
<title>Using fetch() to send an email</title>
|
||||
<para>
|
||||
The email_body.tpl template
|
||||
The <filename>email_body.tpl</filename> template
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
@@ -80,17 +79,18 @@ 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
|
||||
http://{$smarty.server.SERVER_NAME}/login/
|
||||
|
||||
List master
|
||||
Some user group
|
||||
|
||||
{include file="email_disclaimer.tpl"}
|
||||
{include file='email_disclaimer.tpl'}
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
The email_disclaimer.tpl template which uses the
|
||||
<link linkend="language.function.textformat">{textformat}</link> modifier.
|
||||
The <filename>email_disclaimer.tpl</filename> template which uses the
|
||||
<link linkend="language.function.textformat">
|
||||
<varname>{textformat}</varname></link> modifier.
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
@@ -103,8 +103,9 @@ numbered word you have read
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
and the php script using the PHP
|
||||
<ulink url="&url.php-manual;function.mail">mail()</ulink> function
|
||||
The php script using the PHP
|
||||
<ulink url="&url.php-manual;function.mail">
|
||||
<varname>mail()</varname></ulink> function
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
@@ -125,11 +126,11 @@ mail($contact['email'], 'Subject', $smarty->fetch('email_body.tpl'));
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="language.function.fetch">{fetch}</link>
|
||||
<link linkend="api.display">display()</link>,
|
||||
<link linkend="language.function.eval">{eval}</link>,
|
||||
<link linkend="language.function.fetch"><varname>{fetch}</varname></link>
|
||||
<link linkend="api.display"><varname>display()</varname></link>,
|
||||
<link linkend="language.function.eval"><varname>{eval}</varname></link>,
|
||||
and
|
||||
<link linkend="api.template.exists">template_exists()</link>.
|
||||
<link linkend="api.template.exists"><varname>template_exists()</varname></link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -22,25 +22,25 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// get loaded config template var 'foo'
|
||||
$foo = $smarty->get_config_vars('foo');
|
||||
// get loaded config template var #foo#
|
||||
$myVar = $smarty->get_config_vars('foo');
|
||||
|
||||
// get all loaded config template vars
|
||||
$config_vars = $smarty->get_config_vars();
|
||||
$all_config_vars = $smarty->get_config_vars();
|
||||
|
||||
// take a look at them
|
||||
print_r($config_vars);
|
||||
print_r($all_config_vars);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.clear.config">clear_config()</link>,
|
||||
<link linkend="language.function.config.load">{config_load}</link>,
|
||||
<link linkend="api.config.load">config_load()</link>
|
||||
<link linkend="api.clear.config"><varname>clear_config()</varname></link>,
|
||||
<link linkend="language.function.config.load"><varname>{config_load}</varname></link>,
|
||||
<link linkend="api.config.load"><varname>config_load()</varname></link>
|
||||
and
|
||||
<link linkend="api.get.template.vars">get_template_vars()</link>.
|
||||
<link linkend="api.get.template.vars"><varname>get_template_vars()</varname></link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -14,8 +14,8 @@
|
||||
<para>
|
||||
This is useful
|
||||
from within a custom function when you need direct access to a
|
||||
<link linkend="api.register.object">registered object</link>. See
|
||||
<link linkend="advanced.features.objects">objects</link> for more info.
|
||||
<link linkend="api.register.object">registered object</link>. See the
|
||||
<link linkend="advanced.features.objects">objects</link> page for more info.
|
||||
</para>
|
||||
<example>
|
||||
<title>get_registered_object()</title>
|
||||
@@ -36,10 +36,10 @@ function smarty_block_foo($params, &$smarty)
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.register.object">register_object()</link>,
|
||||
<link linkend="api.unregister.object">unregister_object()</link>
|
||||
<link linkend="api.register.object"><varname>register_object()</varname></link>,
|
||||
<link linkend="api.unregister.object"><varname>unregister_object()</varname></link>
|
||||
and
|
||||
<link linkend="advanced.features.objects">objects section</link>
|
||||
<link linkend="advanced.features.objects">objects page</link>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -22,26 +22,25 @@
|
||||
<![CDATA[
|
||||
<?php
|
||||
// get assigned template var 'foo'
|
||||
$foo = $smarty->get_template_vars('foo');
|
||||
$myVar = $smarty->get_template_vars('foo');
|
||||
|
||||
// get all assigned template vars
|
||||
$tpl_vars = $smarty->get_template_vars();
|
||||
$all_tpl_vars = $smarty->get_template_vars();
|
||||
|
||||
// take a look at them
|
||||
print_r($tpl_vars);
|
||||
print_r($all_tpl_vars);
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
See also <link linkend="api.assign">assign()</link>,
|
||||
<link linkend="language.function.assign">{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>
|
||||
See also <link linkend="api.assign"><varname>assign()</varname></link>,
|
||||
<link linkend="language.function.assign"><varname>{assign}</varname></link>,
|
||||
<link linkend="api.append"><varname>append()</varname></link>,
|
||||
<link linkend="api.clear.assign"><varname>clear_assign()</varname></link>,
|
||||
<link linkend="api.clear.all.assign"><varname>clear_all_assign()</varname></link>
|
||||
and
|
||||
<link linkend="api.get.config.vars">get_config_vars()</link>
|
||||
<link linkend="api.get.config.vars"><varname>get_config_vars()</varname></link>
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
@@ -14,11 +14,56 @@
|
||||
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter>
|
||||
</methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
This only works if <link linkend="variable.caching">
|
||||
<parameter>$caching</parameter></link> is set to &true;, see the
|
||||
<link linkend="caching">caching section</link> for more info.
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
You can also pass a <parameter>$cache_id</parameter> as an optional second
|
||||
parameter in case you want
|
||||
<link linkend="caching.multiple.caches">multiple caches</link>
|
||||
for the given template.
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
You can supply a
|
||||
<link linkend="variable.compile.id"><parameter>$compile id</parameter></link>
|
||||
as an optional third parameter. If you omit that parameter the persistent
|
||||
<link linkend="variable.compile.id">
|
||||
<parameter>$compile_id</parameter></link> is used if its set.
|
||||
</para></listitem>
|
||||
|
||||
<listitem><para>
|
||||
If you do not want to pass a <parameter>$cache_id</parameter> but want to
|
||||
pass a <link linkend="variable.compile.id">
|
||||
<parameter>$compile_id</parameter></link> you have to pass
|
||||
&null; as a <parameter>$cache_id</parameter>.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<note>
|
||||
<title>Technical Note</title>
|
||||
<para>
|
||||
This only works if <link
|
||||
linkend="variable.caching">$caching</link> is set to true; see the
|
||||
<link linkend="caching">caching section</link>.
|
||||
If <varname>is_cached()</varname> returns &true; it actually loads the
|
||||
cached output and stores it internally. Any subsequent call to
|
||||
<link linkend="api.display"><varname>display()</varname></link> or
|
||||
<link linkend="api.fetch"><varname>fetch()</varname></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
|
||||
<varname>is_cached()</varname> and to
|
||||
<link linkend="api.display"><varname>display()</varname></link>
|
||||
in the example above. This also means calls to
|
||||
<link linkend="api.clear.cache"><varname>clear_cache()</varname></link>
|
||||
and other changes of the cache-settings may have no effect after
|
||||
<varname>is_cached()</varname> returned &true;.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<example>
|
||||
<title>is_cached()</title>
|
||||
<programlisting role="php">
|
||||
@@ -35,24 +80,7 @@ $smarty->display('index.tpl');
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
You can also pass a $cache id as an optional second parameter
|
||||
in case you want
|
||||
<link linkend="caching.multiple.caches">multiple caches</link>
|
||||
for the given template.
|
||||
</para>
|
||||
<para>
|
||||
You can supply a
|
||||
<link linkend="variable.compile.id">$compile id</link>
|
||||
as an optional third parameter.
|
||||
If you omit that parameter the persistent
|
||||
<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
|
||||
<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>
|
||||
<programlisting role="php">
|
||||
@@ -71,28 +99,10 @@ $smarty->display('index.tpl', 'FrontPage');
|
||||
</example>
|
||||
|
||||
|
||||
<note>
|
||||
<title>Technical Note</title>
|
||||
<para>
|
||||
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
|
||||
<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>,
|
||||
<link linkend="api.clear.cache"><varname>clear_cache()</varname></link>,
|
||||
<link linkend="api.clear.all.cache"><varname>clear_all_cache()</varname></link>,
|
||||
and
|
||||
<link linkend="caching">caching section</link>.
|
||||
</para>
|
||||
|
@@ -13,13 +13,14 @@
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
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'.
|
||||
The first argument specifies the type of the filter to load and can be one
|
||||
of the following: <literal>pre</literal>, <literal>post</literal> or
|
||||
<literal>output</literal>.
|
||||
The second argument specifies the <parameter>name</parameter> of the
|
||||
filter plugin.
|
||||
</para>
|
||||
<example>
|
||||
<title>loading filter plugins</title>
|
||||
<title>Loading filter plugins</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -39,12 +40,12 @@ $smarty->load_filter('output', 'compress');
|
||||
</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>,
|
||||
<link linkend="variable.autoload.filters">$autoload_filters</link>
|
||||
<link linkend="api.register.prefilter"><varname>register_prefilter()</varname></link>,
|
||||
<link linkend="api.register.postfilter"><varname>register_postfilter()</varname></link>,
|
||||
<link linkend="api.register.outputfilter"><varname>register_outputfilter()</varname></link>,
|
||||
<link linkend="variable.autoload.filters"><parameter>$autoload_filters</parameter></link>
|
||||
and
|
||||
<link linkend="advanced.features">Advanced features</link>.
|
||||
<link linkend="advanced.features">advanced features</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -14,37 +14,27 @@
|
||||
<methodparam><type>bool</type><parameter>cacheable</parameter></methodparam>
|
||||
<methodparam><type>mixed</type><parameter>cache_attrs</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<para>
|
||||
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>
|
||||
<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
|
||||
<literal>&$object</literal> being a reference to an
|
||||
object and <literal>$method</literal> being a string
|
||||
containing the method-name or (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.
|
||||
<link linkend="plugins.block.functions">block function plugins</link>.
|
||||
Pass in the block function <parameter>name</parameter>, followed by the PHP
|
||||
function's name that implements it.
|
||||
</para>
|
||||
&api.register.snippet;
|
||||
|
||||
<para>
|
||||
<parameter>cacheable</parameter> and <parameter>cache_attrs</parameter>
|
||||
can be omitted in most cases. See <link
|
||||
linkend="caching.cacheable">Controlling Cacheability of Plugins' Output</link>
|
||||
on how to use them properly.
|
||||
linkend="caching.cacheable">controlling cacheability of plugins' output</link>
|
||||
section on how to implement them properly.
|
||||
</para>
|
||||
<example>
|
||||
<title>register_block()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->register_block('translate', 'do_translation');
|
||||
|
||||
// function declaration
|
||||
function do_translation ($params, $content, &$smarty, &$repeat)
|
||||
{
|
||||
if (isset($content)) {
|
||||
@@ -53,27 +43,27 @@ function do_translation ($params, $content, &$smarty, &$repeat)
|
||||
return $translation;
|
||||
}
|
||||
}
|
||||
|
||||
// register with smarty
|
||||
$smarty->register_block('translate', 'do_translation');
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
where the template is:
|
||||
Where the template is:
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* template *}
|
||||
{translate lang="br"}
|
||||
Hello, world!
|
||||
{/translate}
|
||||
{translate lang='br'}Hello, world!{/translate}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.unregister.block">unregister_block()</link>
|
||||
and
|
||||
<link linkend="plugins.block.functions">Plugin Block Functions</link>.
|
||||
<link linkend="api.unregister.block"><varname>unregister_block()</varname></link>
|
||||
and the
|
||||
<link linkend="plugins.block.functions">plugin block functions</link> page.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
@@ -18,42 +18,20 @@
|
||||
<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:
|
||||
</para>
|
||||
<orderedlist numeration="loweralpha">
|
||||
<listitem>
|
||||
<para>
|
||||
a string containing the function name
|
||||
</para>
|
||||
</listitem><listitem>
|
||||
<para>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 method-name
|
||||
</para>
|
||||
</listitem><listitem>
|
||||
<para>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>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
<para>
|
||||
&api.register.snippet;
|
||||
|
||||
<para>
|
||||
<parameter>cacheable</parameter> can be omitted in
|
||||
most cases. See <link linkend="caching.cacheable">Controlling
|
||||
Cacheability of Plugins' Output</link> on how to use it properly.
|
||||
most cases. See <link linkend="caching.cacheable">controlling
|
||||
cacheability of plugin output</link> on how to use 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>.
|
||||
<link linkend="api.unregister.compiler.function">
|
||||
<varname>unregister_compiler_function()</varname></link>
|
||||
and the
|
||||
<link linkend="plugins.compiler.functions">plugin compiler functions</link> section.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
@@ -19,36 +19,13 @@
|
||||
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
|
||||
</para>
|
||||
<orderedlist numeration="loweralpha">
|
||||
<listitem>
|
||||
<para>
|
||||
a string containing the function name
|
||||
</para>
|
||||
</listitem><listitem>
|
||||
<para>
|
||||
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 method-name
|
||||
</para>
|
||||
</listitem><listitem>
|
||||
<para>
|
||||
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>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
&api.register.snippet;
|
||||
|
||||
|
||||
<para>
|
||||
<parameter>cacheable</parameter> and <parameter>cache_attrs</parameter> can be
|
||||
omitted in most cases. See <link
|
||||
linkend="caching.cacheable">Controlling Cacheability of Plugins' Output</link>
|
||||
linkend="caching.cacheable">controlling cacheability of plugins output</link>
|
||||
on how to use them properly.
|
||||
</para>
|
||||
<example>
|
||||
@@ -85,10 +62,9 @@ function print_current_date($params, &$smarty)
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.unregister.function">unregister_function()</link>
|
||||
and
|
||||
<link linkend="plugins.functions">Plugin functions</link>
|
||||
.
|
||||
<link linkend="api.unregister.function"><varname>unregister_function()</varname></link>
|
||||
and the
|
||||
<link linkend="plugins.functions">plugin functions</link> section.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
@@ -13,34 +13,11 @@
|
||||
<methodparam><type>mixed</type><parameter>impl</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Pass in the
|
||||
template modifier name, followed by the PHP function that it
|
||||
Pass in the template modifier name, followed by the PHP function that it
|
||||
implements it.
|
||||
</para>
|
||||
<para>
|
||||
The php-function callback <parameter>impl</parameter> can be either
|
||||
</para>
|
||||
<orderedlist numeration="loweralpha">
|
||||
<listitem>
|
||||
<para>a string containing the function name
|
||||
</para>
|
||||
</listitem><listitem>
|
||||
<para>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 method-name
|
||||
</para>
|
||||
</listitem><listitem>
|
||||
<para>
|
||||
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>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
&api.register.snippet;
|
||||
|
||||
|
||||
<example>
|
||||
<title>register_modifier()</title>
|
||||
@@ -49,17 +26,16 @@
|
||||
<?php
|
||||
|
||||
// let's map PHP's stripslashes function to a Smarty modifier.
|
||||
$smarty->register_modifier('sslash', 'stripslashes');
|
||||
$smarty->register_modifier('ss', 'stripslashes');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>template</para>
|
||||
<para>In the template, use <literal>ss</literal> to strip slashes.</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
<?php
|
||||
{* use 'sslash' to strip slashes from variables *}
|
||||
{$var|sslash}
|
||||
{$var|ss}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
@@ -67,12 +43,12 @@ $smarty->register_modifier('sslash', 'stripslashes');
|
||||
</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>
|
||||
<link linkend="api.unregister.modifier"><varname>unregister_modifier()</varname></link>,
|
||||
<link linkend="api.register.function"><varname>register_function()</varname></link>,
|
||||
<link linkend="language.modifiers">modifiers</link> section,
|
||||
<link linkend="plugins">extending Smarty with plugins</link>
|
||||
and
|
||||
<link linkend="plugins.modifiers">Creating Plugin modifiers</link>,
|
||||
<link linkend="plugins.modifiers">creating plugin modifiers</link>,
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -19,13 +19,13 @@
|
||||
<para>
|
||||
See the
|
||||
<link linkend="advanced.features.objects">objects section</link>
|
||||
for examples.
|
||||
for more information.
|
||||
</para>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.get.registered.object">get_registered_object()</link>,
|
||||
<link linkend="api.get.registered.object"><varname>get_registered_object()</varname></link>,
|
||||
and
|
||||
<link linkend="api.unregister.object">unregister_object()</link>.
|
||||
<link linkend="api.unregister.object"><varname>unregister_object()</varname></link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -20,42 +20,17 @@
|
||||
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
|
||||
</para>
|
||||
<orderedlist numeration="loweralpha">
|
||||
<listitem>
|
||||
<para>
|
||||
a string containing the function name
|
||||
</para>
|
||||
</listitem><listitem>
|
||||
<para>
|
||||
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 method-name
|
||||
</para>
|
||||
</listitem><listitem>
|
||||
<para>
|
||||
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>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
&api.register.snippet;
|
||||
|
||||
<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>,
|
||||
<link linkend="variable.autoload.filters">$autoload_filters</link>
|
||||
and
|
||||
<link linkend="advanced.features.outputfilters">template
|
||||
output filters</link>.
|
||||
<link linkend="api.unregister.outputfilter"><varname>unregister_outputfilter()</varname></link>,
|
||||
|
||||
<link linkend="api.load.filter"><varname>load_filter()</varname></link>,
|
||||
<link linkend="variable.autoload.filters"><parameter>$autoload_filters</parameter></link>
|
||||
and the
|
||||
<link linkend="advanced.features.outputfilters">template output filters</link>
|
||||
section.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -18,42 +18,20 @@
|
||||
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
|
||||
</para>
|
||||
<orderedlist numeration="loweralpha">
|
||||
<listitem>
|
||||
<para>
|
||||
a string containing the function name
|
||||
</para>
|
||||
</listitem><listitem>
|
||||
<para>
|
||||
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 method-name
|
||||
</para>
|
||||
</listitem><listitem>
|
||||
<para>
|
||||
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>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
&api.register.snippet;
|
||||
|
||||
<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>,
|
||||
<link linkend="variable.autoload.filters">$autoload_filters</link>
|
||||
and
|
||||
<link linkend="advanced.features.outputfilters">template
|
||||
output filters</link>.
|
||||
<link linkend="api.unregister.postfilter">
|
||||
<varname>unregister_postfilter()</varname></link>,
|
||||
<link linkend="api.register.prefilter">
|
||||
<varname>register_prefilter()</varname></link>,
|
||||
<link linkend="api.load.filter"><varname>load_filter()</varname></link>,
|
||||
<link linkend="variable.autoload.filters">
|
||||
<parameter>$autoload_filters</parameter></link>
|
||||
and the
|
||||
<link linkend="advanced.features.outputfilters">template output filters</link>
|
||||
section.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
@@ -18,44 +18,19 @@
|
||||
linkend="advanced.features.prefilters">template prefilters</link> for
|
||||
more information on how to setup a prefiltering function.
|
||||
</para>
|
||||
&api.register.snippet;
|
||||
|
||||
<para>
|
||||
The php-function callback <parameter>function</parameter> can be either
|
||||
</para>
|
||||
<orderedlist numeration="loweralpha">
|
||||
<listitem>
|
||||
<para>
|
||||
a string containing the function name
|
||||
</para>
|
||||
</listitem><listitem>
|
||||
<para>
|
||||
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 method-name
|
||||
</para>
|
||||
</listitem><listitem>
|
||||
<para>
|
||||
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>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
||||
<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>,
|
||||
<link linkend="variable.autoload.filters">$autoload_filters</link>
|
||||
<link linkend="api.unregister.prefilter"><varname>unregister_prefilter()</varname></link>,
|
||||
<link linkend="api.register.postfilter"><varname>register_postfilter()</varname></link>,
|
||||
<link linkend="api.register.outputfilter"><varname>register_ouputfilter()</varname></link>,
|
||||
<link linkend="api.load.filter"><varname>load_filter()</varname></link>,
|
||||
<link linkend="variable.autoload.filters"><parameter>$autoload_filters</parameter></link>
|
||||
and
|
||||
<link linkend="advanced.features.outputfilters">template
|
||||
output filters</link>.
|
||||
<link linkend="advanced.features.outputfilters">template output filters</link>
|
||||
section.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
@@ -16,31 +16,41 @@
|
||||
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
|
||||
Pass in the <parameter>name</parameter> of the resource and the array of
|
||||
PHP functions implementing it. See
|
||||
<link linkend="template.resources">template resources</link>
|
||||
for more information on how to setup a function for fetching
|
||||
templates.
|
||||
</para>
|
||||
<note>
|
||||
for more information on how to setup a function for fetching templates.
|
||||
<note>
|
||||
<title>Technical Note</title>
|
||||
<para>
|
||||
A resource name must be at least two characters in length. One
|
||||
character resource names will be ignored and used as part of the file
|
||||
path, such as $smarty->display('c:/path/to/index.tpl');
|
||||
path, such as <literal>$smarty->display('c:/path/to/index.tpl');</literal>
|
||||
</para>
|
||||
</note>
|
||||
<para>
|
||||
|
||||
</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
The php-function-array <parameter>resource_funcs</parameter>
|
||||
must have 4 or 5 elements. With 4 elements the elements are
|
||||
the functions-callbacks for the respective "source",
|
||||
"timestamp", "secure" and "trusted" functions of the
|
||||
resource. With 5 elements the first element has to be an
|
||||
must have 4 or 5 elements.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
With 4 elements the elements are
|
||||
the functions-callbacks for the respective <literal>source</literal>,
|
||||
<literal>timestamp</literal>, <literal>secure</literal> and
|
||||
<literal>trusted</literal> functions of the resource.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
With 5 elements the first element has to be an
|
||||
object reference or a class name of the object or class
|
||||
implementing the resource and the 4 following elements have
|
||||
to be the method names implementing "source", "timestamp",
|
||||
"secure" and "trusted".
|
||||
</para>
|
||||
to be the method names implementing <literal>source</literal>,
|
||||
<literal>timestamp</literal>, <literal>secure</literal>
|
||||
and <literal>trusted</literal>.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
<example>
|
||||
<title>register_resource()</title>
|
||||
<programlisting role="php">
|
||||
@@ -57,11 +67,11 @@ $smarty->register_resource('db', array(
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.unregister.resource">unregister_resource()</link>
|
||||
and
|
||||
<link linkend="template.resources">template resources</link>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.unregister.resource"><varname>unregister_resource()</varname></link>
|
||||
and the
|
||||
<link linkend="template.resources">template resources</link> section.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
@@ -19,11 +19,10 @@
|
||||
<example>
|
||||
<title>template_exists()</title>
|
||||
<para>
|
||||
This example uses $_GET['page'] to include a content template. If
|
||||
the template doesnt exist then an error page is displayed instead.
|
||||
</para>
|
||||
<para>
|
||||
The <filename>page_container.tpl</filename>
|
||||
This example uses <literal>$_GET['page']</literal> to
|
||||
<link linkend="language.function.include"><varname>{include}</varname></link>
|
||||
a content template. If the template does not exist then an error page
|
||||
is displayed instead. First the <filename>page_container.tpl</filename>
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
@@ -33,14 +32,14 @@
|
||||
{include file='page_top.tpl'}
|
||||
|
||||
{* include middle content page *}
|
||||
{include file=$page_mid}
|
||||
{include file=$content_template}
|
||||
|
||||
{include file='page_footer.tpl'}
|
||||
</body>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
and the php script
|
||||
And the php script
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
@@ -50,9 +49,9 @@
|
||||
$mid_template = $_GET['page'].'.inc.tpl';
|
||||
|
||||
if( !$smarty->template_exists($mid_template) ){
|
||||
$mid_template = 'page_not_found.inc.tpl';
|
||||
$mid_template = 'page_not_found.tpl';
|
||||
}
|
||||
$smarty->assign('page_mid', $mid_template);
|
||||
$smarty->assign('content_template', $mid_template);
|
||||
|
||||
$smarty->display('page_container.tpl');
|
||||
|
||||
@@ -61,16 +60,13 @@ $smarty->display('page_container.tpl');
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
|
||||
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.display">display()</link>,
|
||||
<link linkend="api.fetch">fetch()</link>,
|
||||
<link linkend="language.function.include">{include}</link>
|
||||
<link linkend="api.display"><varname>display()</varname></link>,
|
||||
<link linkend="api.fetch"><varname>fetch()</varname></link>,
|
||||
<link linkend="language.function.include"><varname>{include}</varname></link>
|
||||
and
|
||||
<link linkend="language.function.insert">{insert}</link>
|
||||
<link linkend="language.function.insert"><varname>{insert}</varname></link>
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -15,17 +15,18 @@
|
||||
<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 the PHP
|
||||
<ulink url="&url.php-manual;trigger_error">trigger_error()</ulink>
|
||||
function, i.e. E_USER_NOTICE,
|
||||
E_USER_WARNING, etc. By default it's E_USER_WARNING.
|
||||
used for the PHP <ulink url="&url.php-manual;trigger_error">
|
||||
<varname>trigger_error()</varname></ulink> function, eg:
|
||||
<literal>E_USER_NOTICE</literal>, <literal>E_USER_WARNING</literal>, etc.
|
||||
By default it's <literal>E_USER_WARNING</literal>.
|
||||
</para>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="variable.error.reporting">$error_reporting</link>,
|
||||
<link linkend="variable.error.reporting">
|
||||
<parameter>$error_reporting</parameter></link>,
|
||||
<link linkend="chapter.debugging.console">debugging</link>
|
||||
and
|
||||
<link linkend="smarty.php.errors">Troubleshooting</link>.
|
||||
<link linkend="smarty.php.errors">troubleshooting</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -13,15 +13,15 @@
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Use this to dynamically unregister
|
||||
<link linkend="plugins.block.functions">block function plugins</link>.
|
||||
<link linkend="plugins.block.functions">block function plugin</link>.
|
||||
Pass in the block function <parameter>name</parameter>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.register.block">register_block()</link>
|
||||
<link linkend="api.register.block"><varname>register_block()</varname></link>
|
||||
and
|
||||
<link linkend="plugins.block.functions">Block Functions Plugins</link>.
|
||||
<link linkend="plugins.block.functions">block functions plugins</link>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
@@ -18,11 +18,10 @@
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link
|
||||
linkend="api.register.compiler.function">register_compiler_function()
|
||||
</link>
|
||||
<link linkend="api.register.compiler.function">
|
||||
<varname>register_compiler_function()</varname></link>
|
||||
and
|
||||
<link linkend="plugins.compiler.functions">Plugin Compiler Functions</link>.
|
||||
<link linkend="plugins.compiler.functions">plugin compiler functions</link>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Pass in the template function name.
|
||||
Pass in the template function <parameter>name</parameter>.
|
||||
</para>
|
||||
<example>
|
||||
<title>unregister_function</title>
|
||||
@@ -29,10 +29,8 @@ $smarty->unregister_function('fetch');
|
||||
</example>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link
|
||||
linkend="api.register.function">register_function()
|
||||
</link>.
|
||||
See also <link linkend="api.register.function">
|
||||
<varname>register_function()</varname></link>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Pass in the template modifier name.
|
||||
Pass in the template modifier <parameter>name</parameter>.
|
||||
</para>
|
||||
<example>
|
||||
<title>unregister_modifier()</title>
|
||||
@@ -29,9 +29,9 @@ $smarty->unregister_modifier('strip_tags');
|
||||
</example>
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.register.modifier">register_modifier()</link>
|
||||
<link linkend="api.register.modifier"><varname>register_modifier()</varname></link>
|
||||
and
|
||||
<link linkend="plugins.modifiers">Plugin modifiers</link>,
|
||||
<link linkend="plugins.modifiers">plugin modifiers</link>,
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -14,7 +14,7 @@
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.register.object">register_object()</link>
|
||||
<link linkend="api.register.object"><varname>register_object()</varname></link>
|
||||
and
|
||||
<link linkend="advanced.features.objects">objects section</link>
|
||||
</para>
|
||||
|
@@ -17,10 +17,10 @@
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.register.outputfilter">register_outputfilter()</link>
|
||||
<link linkend="api.register.outputfilter">
|
||||
<varname>register_outputfilter()</varname></link>
|
||||
and
|
||||
<link linkend="advanced.features.outputfilters">template
|
||||
output filters</link>.
|
||||
<link linkend="advanced.features.outputfilters">template output filters</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
@@ -14,10 +14,10 @@
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.unregister.postfilter">register_postfilter()</link>
|
||||
<link linkend="api.unregister.postfilter">
|
||||
<varname>register_postfilter()</varname></link>
|
||||
and
|
||||
<link linkend="plugins.prefilters.postfilters">template
|
||||
post filters</link>.
|
||||
<link linkend="plugins.prefilters.postfilters">template post filters</link>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
@@ -14,7 +14,8 @@
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.register.prefilter">register_prefilter()</link>
|
||||
<link linkend="api.register.prefilter">
|
||||
<varname>register_prefilter()</varname></link>
|
||||
and
|
||||
<link linkend="plugins.prefilters.postfilters">pre filters</link>.
|
||||
</para>
|
||||
|
@@ -12,8 +12,7 @@
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Pass in the
|
||||
name of the resource.
|
||||
Pass in the <parameter>name</parameter> of the resource.
|
||||
</para>
|
||||
<example>
|
||||
<title>unregister_resource()</title>
|
||||
@@ -30,7 +29,8 @@ $smarty->unregister_resource('db');
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.register.resource">register_resource()</link>
|
||||
<link linkend="api.register.resource">
|
||||
<varname>register_resource()</varname></link>
|
||||
and
|
||||
<link linkend="template.resources">template resources</link>
|
||||
</para>
|
||||
|
Reference in New Issue
Block a user