Tidy up formatting and examples

This commit is contained in:
pete_morgan
2006-09-26 23:29:02 +00:00
parent f56effe8fd
commit c9bdfdf1e5
38 changed files with 377 additions and 471 deletions

View File

@@ -15,13 +15,15 @@
</methodsynopsis> </methodsynopsis>
<para> <para>
This is used to 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 If you append a variable by reference then change its
value, the appended value sees the change as well. For value, the appended value sees the change as well. For
<link linkend="advanced.features.objects">objects</link>, <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 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. the value will be merged with the current array instead of appended.
</para> </para>
&note.parameter.merge; &note.parameter.merge;
@@ -38,8 +40,11 @@ $smarty->append_by_ref('Address', $address);
</programlisting> </programlisting>
</example> </example>
<para> <para>
See also <link linkend="api.append">append()</link> and See also
<link linkend="api.assign">assign()</link>. <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> </para>
</refsect1> </refsect1>

View File

@@ -22,7 +22,7 @@ If you append
to a string value, it is converted to an array value and then to a string value, it is converted to an array value and then
appended to. You can explicitly pass name/value pairs, or associative appended to. You can explicitly pass name/value pairs, or associative
arrays containing the name/value pairs. If you pass the optional third 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. instead of appended.
</para> </para>
&note.parameter.merge; &note.parameter.merge;
@@ -31,9 +31,16 @@ If you append
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
// passing name/value pairs // This is effectively the same as assign()
$smarty->append("Name", "Fred"); $smarty->append('foo', 'Fred');
$smarty->append("Address", $address); // 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 // passing an associative array
$smarty->append(array('city' => 'Lincoln', 'state' => 'Nebraska')); $smarty->append(array('city' => 'Lincoln', 'state' => 'Nebraska'));
@@ -42,10 +49,10 @@ $smarty->append(array('city' => 'Lincoln', 'state' => 'Nebraska'));
</programlisting> </programlisting>
</example> </example>
<para>See also <para>See also
<link linkend="api.append.by.ref">append_by_ref()</link>, <link linkend="api.append.by.ref"><varname>append_by_ref()</varname></link>,
<link linkend="api.assign">assign()</link> <link linkend="api.assign"><varname>assign()</varname></link>
and and
<link linkend="api.get.template.vars">get_template_vars()</link> <link linkend="api.get.template.vars"><varname>get_template_vars()</varname></link>
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -13,7 +13,7 @@
<methodparam><type>mixed</type><parameter>var</parameter></methodparam> <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <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 values to the templates by reference instead of
making a copy. See the PHP manual on variable referencing for an explanation. making a copy. See the PHP manual on variable referencing for an explanation.
</para> </para>
@@ -24,7 +24,8 @@
If you assign a variable by reference then change its If you assign a variable by reference then change its
value, the assigned value sees the change as well. For value, the assigned value sees the change as well. For
<link linkend="advanced.features.objects">objects</link>, <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 See the PHP manual on variable referencing for an in-depth
explanation. explanation.
</para> </para>
@@ -42,10 +43,13 @@ $smarty->assign_by_ref('Address', $address);
</programlisting> </programlisting>
</example> </example>
<para> <para>
See also <link linkend="api.assign">assign()</link>, See also
<link linkend="api.clear.all.assign">clear_all_assign()</link>, <link linkend="api.assign"><varname>assign()</varname></link>,
<link linkend="api.append">append()</link> <link linkend="api.clear.all.assign"><varname>clear_all_assign()</varname></link>,
and <link linkend="language.function.assign">{assign}</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> </para>
</refsect1> </refsect1>

View File

@@ -32,6 +32,10 @@ $smarty->assign('Address', $address);
// passing an associative array // passing an associative array
$smarty->assign(array('city' => 'Lincoln', 'state' => 'Nebraska')); $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) // passing a row from a database (eg adodb)
$sql = 'select id, name, email from contacts where contact ='.$id; $sql = 'select id, name, email from contacts where contact ='.$id;
$smarty->assign('contact', $db->getRow($sql)); $smarty->assign('contact', $db->getRow($sql));
@@ -39,7 +43,7 @@ $smarty->assign('contact', $db->getRow($sql));
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Access these in the template with These are accessed in the template with
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -49,24 +53,26 @@ $smarty->assign('contact', $db->getRow($sql));
{$city} {$city}
{$state} {$state}
{$foo.no}, {$foo.label}
{$contact.id}, {$contact.name},{$contact.email} {$contact.id}, {$contact.name},{$contact.email}
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para> <para>
For more complex array assignments see To access more complex array assignments see
<link linkend="language.function.foreach">{foreach}</link> <link linkend="language.function.foreach"><varname>{foreach}</varname></link>
and and
<link linkend="language.function.section">{section}</link> <link linkend="language.function.section"><varname>{section}</varname></link>
</para> </para>
<para> <para>
See also <link linkend="api.assign.by.ref">assign_by_ref()</link>, See also
<link linkend="api.get.template.vars">get_template_vars()</link>, <link linkend="api.assign.by.ref"><varname>assign_by_ref()</varname></link>,
<link linkend="api.clear.assign">clear_assign()</link>, <link linkend="api.get.template.vars"><varname>get_template_vars()</varname></link>,
<link linkend="api.append">append()</link> <link linkend="api.clear.assign"><varname>clear_assign()</varname></link>,
<link linkend="api.append"><varname>append()</varname></link>
and and
<link linkend="language.function.assign">{assign}</link> <link linkend="language.function.assign"><varname>{assign}</varname></link>
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -35,10 +35,11 @@ print_r( $smarty->get_template_vars() );
</example> </example>
<para> <para>
See also See also
<link linkend="api.clear.assign">clear_assign()</link>, <link linkend="api.clear.assign"><varname>clear_assign()</varname></link>,
<link linkend="api.clear.config">clear_config()</link>, <link linkend="api.clear.config"><varname>clear_config()</varname></link>,
<link linkend="api.assign">assign()</link> <link linkend="api.get.template.vars"><varname>get_template_vars()</varname></link>,
and <link linkend="api.append">append()</link> <link linkend="api.assign"><varname>assign()</varname></link>
and <link linkend="api.append"><varname>append()</varname></link>
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -23,16 +23,19 @@
<?php <?php
// clear the entire cache // clear the entire cache
$smarty->clear_all_cache(); $smarty->clear_all_cache();
// clears all files over one hour old
$smarty->clear_all_cache(3600);
?> ?>
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para> <para>
See also See also
<link linkend="api.clear.cache">clear_cache()</link>, <link linkend="api.clear.cache"><varname>clear_cache()</varname></link>,
<link linkend="api.is.cached">is_cached()</link> <link linkend="api.is.cached"><varname>is_cached()</varname></link>
and and the
<link linkend="caching">caching</link> <link linkend="caching">caching</link> page.
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -30,11 +30,11 @@ $smarty->clear_assign(array('Name', 'Address', 'Zip'));
</example> </example>
<para> <para>
See also See also
<link linkend="api.clear.all.assign">clear_all_assign()</link>, <link linkend="api.clear.all.assign"><varname>clear_all_assign()</varname></link>,
<link linkend="api.clear.config">clear_config()</link>, <link linkend="api.clear.config"><varname>clear_config()</varname></link>,
<link linkend="api.get.template.vars">get_template_vars()</link>, <link linkend="api.get.template.vars"><varname>get_template_vars()</varname></link>,
<link linkend="api.assign">assign()</link> <link linkend="api.assign"><varname>assign()</varname></link>
and <link linkend="api.append">append()</link> and <link linkend="api.append"><varname>append()</varname></link>
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -15,21 +15,30 @@
</methodparam> </methodparam>
<methodparam choice="opt"><type>int</type><parameter>expire_time</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>expire_time</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para>
<itemizedlist>
<listitem><para>
If you have <link linkend="caching.multiple.caches">multiple caches</link> If you have <link linkend="caching.multiple.caches">multiple caches</link>
for a template, you can clear a specific for a template, you can clear a specific
cache by supplying the <parameter>cache_id</parameter> as the second cache by supplying the <parameter>cache_id</parameter> as the second
parameter. parameter.
</para></listitem>
<listitem><para>
You can also pass a You can also pass a
<link linkend="variable.compile.id"><parameter>$compile_id</parameter></link> <link linkend="variable.compile.id"><parameter>$compile_id</parameter></link>
as a third parameter. as a third parameter.
You can <link linkend="caching.groups">"group"</link> templates You can <link linkend="caching.groups">group templates together</link>
together so they can be removed as a group. See the so they can be removed as a group, see the
<link linkend="caching">caching section</link> for more <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 minimum age in seconds the cache file must be before it will
get cleared. get cleared.
</para> </para></listitem>
</itemizedlist>
<example> <example>
<title>clear_cache()</title> <title>clear_cache()</title>
<programlisting role="php"> <programlisting role="php">
@@ -39,16 +48,16 @@
$smarty->clear_cache('index.tpl'); $smarty->clear_cache('index.tpl');
// clear the cache for a particular cache id in an multiple-cache template // 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> </programlisting>
</example> </example>
<para> <para>
See also 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 and
<link linkend="caching">caching</link>. <link linkend="caching"><varname>caching</varname></link> section.
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -17,12 +17,13 @@
<para> <para>
This clears the compiled version of the specified template This clears the compiled version of the specified template
resource, or all compiled template files if one is not specified. resource, or all compiled template files if one is not specified.
If you pass a <link linkend="variable.compile.id">$compile_id</link> If you pass a
only the compiled template for this <link linkend="variable.compile.id"><parameter>$compile_id</parameter></link>
specific <link linkend="variable.compile.id">$compile_id</link> only the compiled template for this specific
is cleared. if you pass an exp_time, then only <link linkend="variable.compile.id"><parameter>$compile_id</parameter></link>
compiled templates older than exp_time seconds are cleared, by is cleared. If you pass an exp_time, then only
default all compiled templates are cleared regardless of their age. 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. This function is for advanced use only, not normally needed.
</para> </para>
<example> <example>
@@ -31,7 +32,7 @@
<![CDATA[ <![CDATA[
<?php <?php
// clear a specific template resource // clear a specific template resource
$smarty->clear_compiled_tpl("index.tpl"); $smarty->clear_compiled_tpl('index.tpl');
// clear entire compile directory // clear entire compile directory
$smarty->clear_compiled_tpl(); $smarty->clear_compiled_tpl();
@@ -39,6 +40,9 @@ $smarty->clear_compiled_tpl();
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>See also
<link linkend="api.clear.cache"><varname>clear_cache()</varname></link>.
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -33,13 +33,13 @@ $smarty->clear_config('foobar');
</example> </example>
<para> <para>
See also See also
<link linkend="api.get.config.vars">get_config_vars()</link>, <link linkend="api.get.config.vars"><varname>get_config_vars()</varname></link>,
<link linkend="language.config.variables">config variables</link>, <link linkend="language.config.variables"><varname>config variables</varname></link>,
<link linkend="config.files">config files</link>, <link linkend="config.files"><varname>config files</varname></link>,
<link linkend="language.function.config.load">{config_load}</link>, <link linkend="language.function.config.load"><varname>{config_load}</varname></link>,
<link linkend="api.config.load">config_load()</link> <link linkend="api.config.load"><varname>config_load()</varname></link>
and and
<link linkend="api.clear.assign">clear_assign()</link> <link linkend="api.clear.assign"><varname>clear_assign()</varname></link>.
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -16,22 +16,24 @@
This loads This loads
<link linkend="config.files">config file</link> <link linkend="config.files">config file</link>
data and assigns it to data and assigns it to
the template. This works identical to the template <link the template. This works identically to the template
linkend="language.function.config.load">{config_load}</link> <link linkend="language.function.config.load">
function. <varname>{config_load}</varname></link> function.
</para> </para>
<note> <note>
<title>Technical Note</title> <title>Technical Note</title>
<para> <para>
As of Smarty 2.4.0, assigned template variables are kept across As of Smarty 2.4.0, assigned template variables are kept across
invocations of invocations of
<link linkend="api.fetch">fetch()</link> <link linkend="api.fetch"><varname>fetch()</varname></link>
and <link linkend="api.display">display()</link>. and <link linkend="api.display"><varname>display()</varname></link>.
Config vars loaded from Config vars loaded from
config_load() are always global scope. Config files are also <varname>config_load()</varname> are always global in scope.
compiled for faster execution, and respect the <link Config files are also compiled for faster execution, and respect the
linkend="variable.force.compile">$force_compile</link> and <link <link linkend="variable.force.compile">
linkend="variable.compile.check">$compile_check</link> settings. <parameter>$force_compile</parameter></link> and
<link linkend="variable.compile.check">
<parameter>$compile_check</parameter></link> settings.
</para> </para>
</note> </note>
<example> <example>
@@ -50,11 +52,11 @@ $smarty->config_load('my.conf', 'foobar');
</example> </example>
<para> <para>
See also See also
<link linkend="language.function.config.load">{config_load}</link>, <link linkend="language.function.config.load"><varname>{config_load}</varname></link>,
<link linkend="api.get.config.vars">get_config_vars()</link>, <link linkend="api.get.config.vars"><varname>get_config_vars()</varname></link>,
<link linkend="api.clear.config">clear_config()</link>, <link linkend="api.clear.config"><varname>clear_config()</varname></link>,
and and
<link linkend="language.config.variables">config variables</link> <link linkend="language.config.variables"><varname>config variables</varname></link>
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -16,13 +16,12 @@
</methodsynopsis> </methodsynopsis>
<para> <para>
This displays the template unlike This displays the template unlike
<link linkend="api.fetch">fetch()</link>. <link linkend="api.fetch"><varname>fetch()</varname></link>.
Supply a valid <link Supply a valid <link
linkend="template.resources">template resource</link> linkend="template.resources">template resource</link>
type and path. As an optional second parameter, you can pass a type and path. As an optional second parameter, you can pass a
$cache id. <parameter>$cache id</parameter>, see the
See the <link linkend="caching">caching <link linkend="caching">caching section</link> for more information.
section</link> for more information.
</para> </para>
&parameter.compileid; &parameter.compileid;
<example> <example>
@@ -30,12 +29,12 @@
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
include("Smarty.class.php"); include(SMARTY_DIR.'Smarty.class.php');
$smarty = new Smarty; $smarty = new Smarty();
$smarty->caching = true; $smarty->caching = true;
// only do db calls if cache doesn't exist // 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 // dummy up some data
$address = "245 N 50th"; $address = "245 N 50th";
@@ -47,24 +46,26 @@ if(!$smarty->is_cached("index.tpl")) {
$smarty->assign("Name","Fred"); $smarty->assign("Name","Fred");
$smarty->assign("Address",$address); $smarty->assign("Address",$address);
$smarty->assign($db_data); $smarty->assign('data', $db_data);
} }
// display the output // display the output
$smarty->display("index.tpl"); $smarty->display('index.tpl');
?> ?>
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<example>
<title>Other display() template resource examples</title>
<para> <para>
Use the syntax for <link Use the syntax for <link
linkend="template.resources">template resources</link> to linkend="template.resources">template resources</link> to
display files outside of the 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> </para>
<example>
<title>function display() template resource examples</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -84,8 +85,8 @@ $smarty->display('db:header.tpl');
</programlisting> </programlisting>
</example> </example>
<para> <para>
See also <link linkend="api.fetch">fetch()</link> and See also <link linkend="api.fetch"><varname>fetch()</varname></link> and
<link linkend="api.template.exists">template_exists()</link>. <link linkend="api.template.exists"><varname>template_exists()</varname></link>.
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -20,7 +20,7 @@
Supply a valid <link Supply a valid <link
linkend="template.resources">template resource</link> linkend="template.resources">template resource</link>
type and path. As an optional second parameter, you can pass a 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. section</link> for more information.
</para> </para>
&parameter.compileid; &parameter.compileid;
@@ -57,7 +57,6 @@ if(!$smarty->is_cached('index.tpl')) {
$output = $smarty->fetch('index.tpl'); $output = $smarty->fetch('index.tpl');
// do something with $output here // do something with $output here
echo $output; echo $output;
?> ?>
]]> ]]>
@@ -69,7 +68,7 @@ echo $output;
<example> <example>
<title>Using fetch() to send an email</title> <title>Using fetch() to send an email</title>
<para> <para>
The email_body.tpl template The <filename>email_body.tpl</filename> template
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![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}' Click on the link below to login with your user name of '{$contact.login_id}'
so you can post in our forums. so you can post in our forums.
http://{$smarty.server.SERVER_NAME}/index.php?page=login http://{$smarty.server.SERVER_NAME}/login/
List master List master
Some user group Some user group
{include file="email_disclaimer.tpl"} {include file='email_disclaimer.tpl'}
]]> ]]>
</programlisting> </programlisting>
<para> <para>
The email_disclaimer.tpl template which uses the The <filename>email_disclaimer.tpl</filename> template which uses the
<link linkend="language.function.textformat">{textformat}</link> modifier. <link linkend="language.function.textformat">
<varname>{textformat}</varname></link> modifier.
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -103,8 +103,9 @@ numbered word you have read
]]> ]]>
</programlisting> </programlisting>
<para> <para>
and the php script using the PHP The php script using the PHP
<ulink url="&url.php-manual;function.mail">mail()</ulink> function <ulink url="&url.php-manual;function.mail">
<varname>mail()</varname></ulink> function
</para> </para>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
@@ -125,11 +126,11 @@ mail($contact['email'], 'Subject', $smarty->fetch('email_body.tpl'));
<para> <para>
See also See also
<link linkend="language.function.fetch">{fetch}</link> <link linkend="language.function.fetch"><varname>{fetch}</varname></link>
<link linkend="api.display">display()</link>, <link linkend="api.display"><varname>display()</varname></link>,
<link linkend="language.function.eval">{eval}</link>, <link linkend="language.function.eval"><varname>{eval}</varname></link>,
and and
<link linkend="api.template.exists">template_exists()</link>. <link linkend="api.template.exists"><varname>template_exists()</varname></link>.
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -22,25 +22,25 @@
<![CDATA[ <![CDATA[
<?php <?php
// get loaded config template var 'foo' // get loaded config template var #foo#
$foo = $smarty->get_config_vars('foo'); $myVar = $smarty->get_config_vars('foo');
// get all loaded config template vars // get all loaded config template vars
$config_vars = $smarty->get_config_vars(); $all_config_vars = $smarty->get_config_vars();
// take a look at them // take a look at them
print_r($config_vars); print_r($all_config_vars);
?> ?>
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para> <para>
See also See also
<link linkend="api.clear.config">clear_config()</link>, <link linkend="api.clear.config"><varname>clear_config()</varname></link>,
<link linkend="language.function.config.load">{config_load}</link>, <link linkend="language.function.config.load"><varname>{config_load}</varname></link>,
<link linkend="api.config.load">config_load()</link> <link linkend="api.config.load"><varname>config_load()</varname></link>
and and
<link linkend="api.get.template.vars">get_template_vars()</link>. <link linkend="api.get.template.vars"><varname>get_template_vars()</varname></link>.
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -14,8 +14,8 @@
<para> <para>
This is useful This is useful
from within a custom function when you need direct access to a from within a custom function when you need direct access to a
<link linkend="api.register.object">registered object</link>. See <link linkend="api.register.object">registered object</link>. See the
<link linkend="advanced.features.objects">objects</link> for more info. <link linkend="advanced.features.objects">objects</link> page for more info.
</para> </para>
<example> <example>
<title>get_registered_object()</title> <title>get_registered_object()</title>
@@ -36,10 +36,10 @@ function smarty_block_foo($params, &$smarty)
</example> </example>
<para> <para>
See also See also
<link linkend="api.register.object">register_object()</link>, <link linkend="api.register.object"><varname>register_object()</varname></link>,
<link linkend="api.unregister.object">unregister_object()</link> <link linkend="api.unregister.object"><varname>unregister_object()</varname></link>
and and
<link linkend="advanced.features.objects">objects section</link> <link linkend="advanced.features.objects">objects page</link>
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -22,26 +22,25 @@
<![CDATA[ <![CDATA[
<?php <?php
// get assigned template var 'foo' // get assigned template var 'foo'
$foo = $smarty->get_template_vars('foo'); $myVar = $smarty->get_template_vars('foo');
// get all assigned template vars // get all assigned template vars
$tpl_vars = $smarty->get_template_vars(); $all_tpl_vars = $smarty->get_template_vars();
// take a look at them // take a look at them
print_r($tpl_vars); print_r($all_tpl_vars);
?> ?>
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para> <para>
See also <link linkend="api.assign">assign()</link>, See also <link linkend="api.assign"><varname>assign()</varname></link>,
<link linkend="language.function.assign">{assign}</link>, <link linkend="language.function.assign"><varname>{assign}</varname></link>,
<link linkend="api.assign.by.ref">assign_by_ref()</link>, <link linkend="api.append"><varname>append()</varname></link>,
<link linkend="api.append">append()</link>, <link linkend="api.clear.assign"><varname>clear_assign()</varname></link>,
<link linkend="api.clear.assign">clear_assign()</link>, <link linkend="api.clear.all.assign"><varname>clear_all_assign()</varname></link>
<link linkend="api.clear.all.assign">clear_all_assign()</link>
and and
<link linkend="api.get.config.vars">get_config_vars()</link> <link linkend="api.get.config.vars"><varname>get_config_vars()</varname></link>
</para> </para>
</refsect1> </refsect1>

View File

@@ -14,11 +14,56 @@
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter> <methodparam choice="opt"><type>string</type><parameter>compile_id</parameter>
</methodparam> </methodparam>
</methodsynopsis> </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> <para>
This only works if <link If <varname>is_cached()</varname> returns &true; it actually loads the
linkend="variable.caching">$caching</link> is set to true; see the cached output and stores it internally. Any subsequent call to
<link linkend="caching">caching section</link>. <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> </para>
</note>
<example> <example>
<title>is_cached()</title> <title>is_cached()</title>
<programlisting role="php"> <programlisting role="php">
@@ -35,24 +80,7 @@ $smarty->display('index.tpl');
]]> ]]>
</programlisting> </programlisting>
</example> </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> <example>
<title>is_cached() with multiple-cache template</title> <title>is_cached() with multiple-cache template</title>
<programlisting role="php"> <programlisting role="php">
@@ -71,28 +99,10 @@ $smarty->display('index.tpl', 'FrontPage');
</example> </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> <para>
See also See also
<link linkend="api.clear.cache">clear_cache()</link>, <link linkend="api.clear.cache"><varname>clear_cache()</varname></link>,
<link linkend="api.clear.all.cache">clear_all_cache()</link>, <link linkend="api.clear.all.cache"><varname>clear_all_cache()</varname></link>,
and and
<link linkend="caching">caching section</link>. <link linkend="caching">caching section</link>.
</para> </para>

View File

@@ -13,13 +13,14 @@
<methodparam><type>string</type><parameter>name</parameter></methodparam> <methodparam><type>string</type><parameter>name</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
The first The first argument specifies the type of the filter to load and can be one
argument specifies the type of the filter to load and can be one of the following: <literal>pre</literal>, <literal>post</literal> or
of the following: 'pre', 'post', or 'output'. The second argument <literal>output</literal>.
specifies the name of the filter plugin, for example, 'trim'. The second argument specifies the <parameter>name</parameter> of the
filter plugin.
</para> </para>
<example> <example>
<title>loading filter plugins</title> <title>Loading filter plugins</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -39,12 +40,12 @@ $smarty->load_filter('output', 'compress');
</example> </example>
<para> <para>
See also See also
<link linkend="api.register.prefilter">register_prefilter()</link>, <link linkend="api.register.prefilter"><varname>register_prefilter()</varname></link>,
<link linkend="api.register.postfilter">register_postfilter()</link>, <link linkend="api.register.postfilter"><varname>register_postfilter()</varname></link>,
<link linkend="api.register.outputfilter">register_outputfilter()</link>, <link linkend="api.register.outputfilter"><varname>register_outputfilter()</varname></link>,
<link linkend="variable.autoload.filters">$autoload_filters</link> <link linkend="variable.autoload.filters"><parameter>$autoload_filters</parameter></link>
and and
<link linkend="advanced.features">Advanced features</link>. <link linkend="advanced.features">advanced features</link>.
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -14,37 +14,27 @@
<methodparam><type>bool</type><parameter>cacheable</parameter></methodparam> <methodparam><type>bool</type><parameter>cacheable</parameter></methodparam>
<methodparam><type>mixed</type><parameter>cache_attrs</parameter></methodparam> <methodparam><type>mixed</type><parameter>cache_attrs</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Use this to dynamically register Use this to dynamically register
<link linkend="plugins.block.functions">block functions plugins</link>. <link linkend="plugins.block.functions">block function plugins</link>.
Pass in the block function name, followed by the PHP Pass in the block function <parameter>name</parameter>, followed by the PHP
function callback that implements it. function's 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
<literal>array(&amp;$object, $method)</literal> with
<literal>&amp;$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(&amp;$class, $method)</literal> with
<literal>$class</literal> being a classname and
<literal>$method</literal> being a class method of that
class.
</para> </para>
&api.register.snippet;
<para> <para>
<parameter>cacheable</parameter> and <parameter>cache_attrs</parameter> <parameter>cacheable</parameter> and <parameter>cache_attrs</parameter>
can be omitted in most cases. See <link 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. section on how to implement them properly.
</para> </para>
<example> <example>
<title>register_block()</title> <title>register_block()</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
$smarty->register_block('translate', 'do_translation'); // function declaration
function do_translation ($params, $content, &$smarty, &$repeat) function do_translation ($params, $content, &$smarty, &$repeat)
{ {
if (isset($content)) { if (isset($content)) {
@@ -53,27 +43,27 @@ function do_translation ($params, $content, &$smarty, &$repeat)
return $translation; return $translation;
} }
} }
// register with smarty
$smarty->register_block('translate', 'do_translation');
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
where the template is: Where the template is:
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{* template *} {translate lang='br'}Hello, world!{/translate}
{translate lang="br"}
Hello, world!
{/translate}
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para> <para>
See also See also
<link linkend="api.unregister.block">unregister_block()</link> <link linkend="api.unregister.block"><varname>unregister_block()</varname></link>
and and the
<link linkend="plugins.block.functions">Plugin Block Functions</link>. <link linkend="plugins.block.functions">plugin block functions</link> page.
</para> </para>
</refsect1> </refsect1>

View File

@@ -18,42 +18,20 @@
<link linkend="plugins.compiler.functions">compiler function</link> name, <link linkend="plugins.compiler.functions">compiler function</link> name,
followed by the PHP function that implements it. followed by the PHP function that implements it.
</para> </para>
<para> &api.register.snippet;
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(&amp;$object, $method)</literal> with
<literal>&amp;$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(&amp;$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> <para>
<parameter>cacheable</parameter> can be omitted in <parameter>cacheable</parameter> can be omitted in
most cases. See <link linkend="caching.cacheable">Controlling most cases. See <link linkend="caching.cacheable">controlling
Cacheability of Plugins' Output</link> on how to use it properly. cacheability of plugin output</link> on how to use it properly.
</para> </para>
<para> <para>
See also See also
<link <link linkend="api.unregister.compiler.function">
linkend="api.unregister.compiler.function">unregister_compiler_function() <varname>unregister_compiler_function()</varname></link>
</link> and the
and <link linkend="plugins.compiler.functions">plugin compiler functions</link> section.
<link linkend="plugins.compiler.functions">Plugin Compiler Functions</link>.
</para> </para>
</refsect1> </refsect1>

View File

@@ -19,36 +19,13 @@
Pass in the <link linkend="plugins.functions">template function</link> Pass in the <link linkend="plugins.functions">template function</link>
name, followed by the PHP function name that implements it. name, followed by the PHP function name that implements it.
</para> </para>
<para> &api.register.snippet;
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(&amp;$object, $method)</literal> with
<literal>&amp;$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(&amp;$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> <para>
<parameter>cacheable</parameter> and <parameter>cache_attrs</parameter> can be <parameter>cacheable</parameter> and <parameter>cache_attrs</parameter> can be
omitted in most cases. See <link 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. on how to use them properly.
</para> </para>
<example> <example>
@@ -85,10 +62,9 @@ function print_current_date($params, &$smarty)
<para> <para>
See also See also
<link linkend="api.unregister.function">unregister_function()</link> <link linkend="api.unregister.function"><varname>unregister_function()</varname></link>
and and the
<link linkend="plugins.functions">Plugin functions</link> <link linkend="plugins.functions">plugin functions</link> section.
.
</para> </para>
</refsect1> </refsect1>

View File

@@ -13,34 +13,11 @@
<methodparam><type>mixed</type><parameter>impl</parameter></methodparam> <methodparam><type>mixed</type><parameter>impl</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Pass in the Pass in the template modifier name, followed by the PHP function that it
template modifier name, followed by the PHP function that it
implements it. implements it.
</para> </para>
<para> &api.register.snippet;
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(&amp;$object,
$method)</literal> with <literal>&amp;$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(&amp;$class, $method)</literal> with
<literal>$class</literal> being a classname and
<literal>$method</literal> being a class method of that
class.
</para>
</listitem>
</orderedlist>
<example> <example>
<title>register_modifier()</title> <title>register_modifier()</title>
@@ -49,17 +26,16 @@
<?php <?php
// let's map PHP's stripslashes function to a Smarty modifier. // let's map PHP's stripslashes function to a Smarty modifier.
$smarty->register_modifier('sslash', 'stripslashes'); $smarty->register_modifier('ss', 'stripslashes');
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para>template</para> <para>In the template, use <literal>ss</literal> to strip slashes.</para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
<?php <?php
{* use 'sslash' to strip slashes from variables *} {$var|ss}
{$var|sslash}
?> ?>
]]> ]]>
</programlisting> </programlisting>
@@ -67,12 +43,12 @@ $smarty->register_modifier('sslash', 'stripslashes');
</example> </example>
<para> <para>
See also See also
<link linkend="api.unregister.modifier">unregister_modifier()</link>, <link linkend="api.unregister.modifier"><varname>unregister_modifier()</varname></link>,
<link linkend="api.register.function">register_function()</link>, <link linkend="api.register.function"><varname>register_function()</varname></link>,
<link linkend="language.modifiers">modifiers</link>, <link linkend="language.modifiers">modifiers</link> section,
<link linkend="plugins">Extending Smarty with plugins</link> <link linkend="plugins">extending Smarty with plugins</link>
and and
<link linkend="plugins.modifiers">Creating Plugin modifiers</link>, <link linkend="plugins.modifiers">creating plugin modifiers</link>,
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -19,13 +19,13 @@
<para> <para>
See the See the
<link linkend="advanced.features.objects">objects section</link> <link linkend="advanced.features.objects">objects section</link>
for examples. for more information.
</para> </para>
<para> <para>
See also 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 and
<link linkend="api.unregister.object">unregister_object()</link>. <link linkend="api.unregister.object"><varname>unregister_object()</varname></link>.
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -20,42 +20,17 @@
filters</link> filters</link>
for more information on how to set up an output filter function. for more information on how to set up an output filter function.
</para> </para>
<para> &api.register.snippet;
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(&amp;$object, $method)</literal> with
<literal>&amp;$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(&amp;$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> <para>
See also See also
<link linkend="api.unregister.outputfilter">unregister_outputfilter()</link>, <link linkend="api.unregister.outputfilter"><varname>unregister_outputfilter()</varname></link>,
<link linkend="api.register.prefilter">register_prefilter()</link>,
<link linkend="api.register.postfilter">register_postfilter()</link>, <link linkend="api.load.filter"><varname>load_filter()</varname></link>,
<link linkend="api.load.filter">load_filter()</link>, <link linkend="variable.autoload.filters"><parameter>$autoload_filters</parameter></link>
<link linkend="variable.autoload.filters">$autoload_filters</link> and the
and <link linkend="advanced.features.outputfilters">template output filters</link>
<link linkend="advanced.features.outputfilters">template section.
output filters</link>.
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -18,42 +18,20 @@
linkend="advanced.features.postfilters">template postfilters</link> for linkend="advanced.features.postfilters">template postfilters</link> for
more information on how to setup a postfiltering function. more information on how to setup a postfiltering function.
</para> </para>
<para> &api.register.snippet;
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(&amp;$object, $method)</literal> with
<literal>&amp;$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(&amp;$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> <para>
See also See also
<link linkend="api.unregister.postfilter">unregister_postfilter()</link>, <link linkend="api.unregister.postfilter">
<link linkend="api.register.prefilter">register_prefilter()</link>, <varname>unregister_postfilter()</varname></link>,
<link linkend="api.register.outputfilter">register_ouputfilter()</link>, <link linkend="api.register.prefilter">
<link linkend="api.load.filter">load_filter()</link>, <varname>register_prefilter()</varname></link>,
<link linkend="variable.autoload.filters">$autoload_filters</link> <link linkend="api.load.filter"><varname>load_filter()</varname></link>,
and <link linkend="variable.autoload.filters">
<link linkend="advanced.features.outputfilters">template <parameter>$autoload_filters</parameter></link>
output filters</link>. and the
<link linkend="advanced.features.outputfilters">template output filters</link>
section.
</para> </para>
</refsect1> </refsect1>

View File

@@ -18,44 +18,19 @@
linkend="advanced.features.prefilters">template prefilters</link> for linkend="advanced.features.prefilters">template prefilters</link> for
more information on how to setup a prefiltering function. more information on how to setup a prefiltering function.
</para> </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(&amp;$object, $method)</literal> with
<literal>&amp;$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(&amp;$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> <para>
See also See also
<link linkend="api.unregister.prefilter">unregister_prefilter()</link>, <link linkend="api.unregister.prefilter"><varname>unregister_prefilter()</varname></link>,
<link linkend="api.register.postfilter">register_postfilter()</link>, <link linkend="api.register.postfilter"><varname>register_postfilter()</varname></link>,
<link linkend="api.register.outputfilter">register_ouputfilter()</link>, <link linkend="api.register.outputfilter"><varname>register_ouputfilter()</varname></link>,
<link linkend="api.load.filter">load_filter()</link>, <link linkend="api.load.filter"><varname>load_filter()</varname></link>,
<link linkend="variable.autoload.filters">$autoload_filters</link> <link linkend="variable.autoload.filters"><parameter>$autoload_filters</parameter></link>
and and
<link linkend="advanced.features.outputfilters">template <link linkend="advanced.features.outputfilters">template output filters</link>
output filters</link>. section.
</para> </para>
</refsect1> </refsect1>

View File

@@ -16,31 +16,41 @@
Use this to dynamically register a Use this to dynamically register a
<link linkend="template.resources">resource plugin</link> <link linkend="template.resources">resource plugin</link>
with Smarty. with Smarty.
Pass in the name of the resource and the array of PHP functions Pass in the <parameter>name</parameter> of the resource and the array of
implementing it. See PHP functions implementing it. See
<link linkend="template.resources">template resources</link> <link linkend="template.resources">template resources</link>
for more information on how to setup a function for fetching for more information on how to setup a function for fetching templates.
templates.
</para>
<note> <note>
<title>Technical Note</title> <title>Technical Note</title>
<para> <para>
A resource name must be at least two characters in length. One 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 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> </para>
</note> </note>
<para>
</para>
<itemizedlist>
<listitem><para>
The php-function-array <parameter>resource_funcs</parameter> The php-function-array <parameter>resource_funcs</parameter>
must have 4 or 5 elements. With 4 elements the elements are must have 4 or 5 elements.
the functions-callbacks for the respective "source", </para></listitem>
"timestamp", "secure" and "trusted" functions of the <listitem><para>
resource. With 5 elements the first element has to be an 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 object reference or a class name of the object or class
implementing the resource and the 4 following elements have implementing the resource and the 4 following elements have
to be the method names implementing "source", "timestamp", to be the method names implementing <literal>source</literal>,
"secure" and "trusted". <literal>timestamp</literal>, <literal>secure</literal>
</para> and <literal>trusted</literal>.
</para></listitem>
</itemizedlist>
<example> <example>
<title>register_resource()</title> <title>register_resource()</title>
<programlisting role="php"> <programlisting role="php">
@@ -59,9 +69,9 @@ $smarty->register_resource('db', array(
<para> <para>
See also See also
<link linkend="api.unregister.resource">unregister_resource()</link> <link linkend="api.unregister.resource"><varname>unregister_resource()</varname></link>
and and the
<link linkend="template.resources">template resources</link> <link linkend="template.resources">template resources</link> section.
</para> </para>
</refsect1> </refsect1>

View File

@@ -19,11 +19,10 @@
<example> <example>
<title>template_exists()</title> <title>template_exists()</title>
<para> <para>
This example uses $_GET['page'] to include a content template. If This example uses <literal>$_GET['page']</literal> to
the template doesnt exist then an error page is displayed instead. <link linkend="language.function.include"><varname>{include}</varname></link>
</para> a content template. If the template does not exist then an error page
<para> is displayed instead. First the <filename>page_container.tpl</filename>
The <filename>page_container.tpl</filename>
</para> </para>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
@@ -33,14 +32,14 @@
{include file='page_top.tpl'} {include file='page_top.tpl'}
{* include middle content page *} {* include middle content page *}
{include file=$page_mid} {include file=$content_template}
{include file='page_footer.tpl'} {include file='page_footer.tpl'}
</body> </body>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
and the php script And the php script
</para> </para>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
@@ -50,9 +49,9 @@
$mid_template = $_GET['page'].'.inc.tpl'; $mid_template = $_GET['page'].'.inc.tpl';
if( !$smarty->template_exists($mid_template) ){ 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'); $smarty->display('page_container.tpl');
@@ -61,16 +60,13 @@ $smarty->display('page_container.tpl');
</programlisting> </programlisting>
</example> </example>
<para> <para>
See also See also
<link linkend="api.display">display()</link>, <link linkend="api.display"><varname>display()</varname></link>,
<link linkend="api.fetch">fetch()</link>, <link linkend="api.fetch"><varname>fetch()</varname></link>,
<link linkend="language.function.include">{include}</link> <link linkend="language.function.include"><varname>{include}</varname></link>
and and
<link linkend="language.function.insert">{insert}</link> <link linkend="language.function.insert"><varname>{insert}</varname></link>
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -15,17 +15,18 @@
<para> <para>
This function can be used to output an error message using Smarty. This function can be used to output an error message using Smarty.
<parameter>level</parameter> parameter can be one of the values <parameter>level</parameter> parameter can be one of the values
used for the PHP used for the PHP <ulink url="&url.php-manual;trigger_error">
<ulink url="&url.php-manual;trigger_error">trigger_error()</ulink> <varname>trigger_error()</varname></ulink> function, eg:
function, i.e. E_USER_NOTICE, <literal>E_USER_NOTICE</literal>, <literal>E_USER_WARNING</literal>, etc.
E_USER_WARNING, etc. By default it's E_USER_WARNING. By default it's <literal>E_USER_WARNING</literal>.
</para> </para>
<para> <para>
See also 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> <link linkend="chapter.debugging.console">debugging</link>
and and
<link linkend="smarty.php.errors">Troubleshooting</link>. <link linkend="smarty.php.errors">troubleshooting</link>.
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -13,15 +13,15 @@
</methodsynopsis> </methodsynopsis>
<para> <para>
Use this to dynamically unregister 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>. Pass in the block function <parameter>name</parameter>.
</para> </para>
<para> <para>
See also See also
<link linkend="api.register.block">register_block()</link> <link linkend="api.register.block"><varname>register_block()</varname></link>
and and
<link linkend="plugins.block.functions">Block Functions Plugins</link>. <link linkend="plugins.block.functions">block functions plugins</link>.
</para> </para>
</refsect1> </refsect1>

View File

@@ -18,11 +18,10 @@
<para> <para>
See also See also
<link <link linkend="api.register.compiler.function">
linkend="api.register.compiler.function">register_compiler_function() <varname>register_compiler_function()</varname></link>
</link>
and and
<link linkend="plugins.compiler.functions">Plugin Compiler Functions</link>. <link linkend="plugins.compiler.functions">plugin compiler functions</link>.
</para> </para>
</refsect1> </refsect1>

View File

@@ -12,7 +12,7 @@
<methodparam><type>string</type><parameter>name</parameter></methodparam> <methodparam><type>string</type><parameter>name</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Pass in the template function name. Pass in the template function <parameter>name</parameter>.
</para> </para>
<example> <example>
<title>unregister_function</title> <title>unregister_function</title>
@@ -29,10 +29,8 @@ $smarty->unregister_function('fetch');
</example> </example>
<para> <para>
See also See also <link linkend="api.register.function">
<link <varname>register_function()</varname></link>.
linkend="api.register.function">register_function()
</link>.
</para> </para>
</refsect1> </refsect1>

View File

@@ -12,7 +12,7 @@
<methodparam><type>string</type><parameter>name</parameter></methodparam> <methodparam><type>string</type><parameter>name</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Pass in the template modifier name. Pass in the template modifier <parameter>name</parameter>.
</para> </para>
<example> <example>
<title>unregister_modifier()</title> <title>unregister_modifier()</title>
@@ -29,9 +29,9 @@ $smarty->unregister_modifier('strip_tags');
</example> </example>
<para> <para>
See also See also
<link linkend="api.register.modifier">register_modifier()</link> <link linkend="api.register.modifier"><varname>register_modifier()</varname></link>
and and
<link linkend="plugins.modifiers">Plugin modifiers</link>, <link linkend="plugins.modifiers">plugin modifiers</link>,
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -14,7 +14,7 @@
<para> <para>
See also See also
<link linkend="api.register.object">register_object()</link> <link linkend="api.register.object"><varname>register_object()</varname></link>
and and
<link linkend="advanced.features.objects">objects section</link> <link linkend="advanced.features.objects">objects section</link>
</para> </para>

View File

@@ -17,10 +17,10 @@
<para> <para>
See also See also
<link linkend="api.register.outputfilter">register_outputfilter()</link> <link linkend="api.register.outputfilter">
<varname>register_outputfilter()</varname></link>
and and
<link linkend="advanced.features.outputfilters">template <link linkend="advanced.features.outputfilters">template output filters</link>.
output filters</link>.
</para> </para>
</refsect1> </refsect1>
</refentry> </refentry>

View File

@@ -14,10 +14,10 @@
<para> <para>
See also See also
<link linkend="api.unregister.postfilter">register_postfilter()</link> <link linkend="api.unregister.postfilter">
<varname>register_postfilter()</varname></link>
and and
<link linkend="plugins.prefilters.postfilters">template <link linkend="plugins.prefilters.postfilters">template post filters</link>.
post filters</link>.
</para> </para>
</refsect1> </refsect1>

View File

@@ -14,7 +14,8 @@
<para> <para>
See also See also
<link linkend="api.register.prefilter">register_prefilter()</link> <link linkend="api.register.prefilter">
<varname>register_prefilter()</varname></link>
and and
<link linkend="plugins.prefilters.postfilters">pre filters</link>. <link linkend="plugins.prefilters.postfilters">pre filters</link>.
</para> </para>

View File

@@ -12,8 +12,7 @@
<methodparam><type>string</type><parameter>name</parameter></methodparam> <methodparam><type>string</type><parameter>name</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Pass in the Pass in the <parameter>name</parameter> of the resource.
name of the resource.
</para> </para>
<example> <example>
<title>unregister_resource()</title> <title>unregister_resource()</title>
@@ -30,7 +29,8 @@ $smarty->unregister_resource('db');
<para> <para>
See also See also
<link linkend="api.register.resource">register_resource()</link> <link linkend="api.register.resource">
<varname>register_resource()</varname></link>
and and
<link linkend="template.resources">template resources</link> <link linkend="template.resources">template resources</link>
</para> </para>