docs-update for plugins.writing

This commit is contained in:
messju
2003-08-05 16:49:31 +00:00
parent a27d6d5a1c
commit ed1fd2f0f1

View File

@@ -1140,7 +1140,7 @@ $smarty->load_filter('output', 'compress'); // load output filter named 'compres
/* PHP */ /* PHP */
$smarty->register_block("translate", "do_translation"); $smarty->register_block("translate", "do_translation");
function do_translation ($params, $content, &$smarty) { function do_translation ($params, $content, &$smarty, &$repeat) {
if ($content) { if ($content) {
$lang = $params['lang']; $lang = $params['lang'];
// do some translation with $content // do some translation with $content
@@ -2390,10 +2390,13 @@ $smarty->default_template_handler_func = 'make_template';
way to load the needed plugin is this: way to load the needed plugin is this:
</para> </para>
<programlisting> <programlisting>
require_once SMARTY_DIR . 'plugins/function.html_options.php';</programlisting> require_once $smarty->_get_plugin_filepath('function', 'html_options');</programlisting>
<para> <para>
As a general rule, Smarty object is always passed to the plugins as the last As a general rule, Smarty object is always passed to the plugins
parameter (except for modifiers). as the last parameter (with two exceptions: modifiers do not get
passed the Smarty object at all and blocks get passed
<parameter>&amp;$repeat</parameter> after the Smarty object to keep
backwards compatibility to older versions of Smarty).
</para> </para>
</sect1> </sect1>
@@ -2605,7 +2608,7 @@ function smarty_modifier_truncate($string, $length = 80, $etc = '...',
<para> <para>
By default your function implementation is called twice by By default your function implementation is called twice by
Smarty: once for the opening tag, and once for the closing tag Smarty: once for the opening tag, and once for the closing tag
(see <literal>&$repeat</literal> below how to change this). (see <literal>&amp;$repeat</literal> below how to change this).
</para> </para>
<para> <para>
Only the opening tag of the block function may have attributes. All Only the opening tag of the block function may have attributes. All
@@ -2628,7 +2631,7 @@ function smarty_modifier_truncate($string, $length = 80, $etc = '...',
</para> </para>
<para> <para>
The parameter <parameter>&$repeat</parameter> is passed by The parameter <parameter>&amp;$repeat</parameter> is passed by
reference to the function implementation and provides a reference to the function implementation and provides a
possibility for it to control how many times the block is possibility for it to control how many times the block is
displayed. By default <parameter>$repeat</parameter> is displayed. By default <parameter>$repeat</parameter> is
@@ -2636,7 +2639,7 @@ function smarty_modifier_truncate($string, $length = 80, $etc = '...',
(the block opening tag) and <literal>false</literal> on all (the block opening tag) and <literal>false</literal> on all
subsequent calls to the block function (the block's closing tag). subsequent calls to the block function (the block's closing tag).
Each time the function implementation returns with Each time the function implementation returns with
<parameter>&$repeat</parameter> being true, the contents between <parameter>&amp;$repeat</parameter> being true, the contents between
{func} .. {/func} are evaluated and the function implementation {func} .. {/func} are evaluated and the function implementation
is called again with the new block contents in the parameter is called again with the new block contents in the parameter
<parameter>$content</parameter>. <parameter>$content</parameter>.