mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-06 07:11:37 +01:00
more linking and WS from Peter
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.register.block">
|
||||
<refnamediv>
|
||||
<refname>register_block</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>register_block()</refname>
|
||||
<refpurpose>dynamically register block functions plugins</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>register_block</methodname>
|
||||
<methodparam><type>string</type><parameter>name</parameter></methodparam>
|
||||
@@ -15,7 +15,8 @@
|
||||
<methodparam><type>mixed</type><parameter>cache_attrs</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Use this to dynamically register block functions plugins.
|
||||
Use this to dynamically register
|
||||
<link linkend="plugins.block.functions">block functions plugins</link>.
|
||||
Pass in the block function name, followed by the PHP
|
||||
function callback that implements it.
|
||||
</para>
|
||||
@@ -33,18 +34,18 @@
|
||||
</para>
|
||||
<para>
|
||||
<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>
|
||||
on how to use them properly.
|
||||
</para>
|
||||
<example>
|
||||
<title>register_block</title>
|
||||
<title>register_block()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
$smarty->register_block("translate", "do_translation");
|
||||
$smarty->register_block('translate', 'do_translation');
|
||||
|
||||
function do_translation ($params, $content, &$smarty, &$repeat)
|
||||
function do_translation ($params, $content, &$smarty, &$repeat)
|
||||
{
|
||||
if (isset($content)) {
|
||||
$lang = $params['lang'];
|
||||
@@ -67,6 +68,14 @@ Hello, world!
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
<para>
|
||||
See also
|
||||
<link linkend="api.unregister.block">unregister_block()</link>
|
||||
and
|
||||
<link linkend="plugins.block.functions">Plugin Block Functions</link>.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
||||
Reference in New Issue
Block a user