Files
smarty/docs/ru/programmers/api-functions/api-register-resource.xml
2008-05-25 15:06:11 +00:00

76 lines
3.0 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: 0 Maintainer: tony2001 Status: ready -->
<refentry id="api.register.resource">
<refnamediv>
<refname>register_resource</refname>
<refpurpose></refpurpose>
</refnamediv>
<refsect1>
<title />
<methodsynopsis>
<type>void</type><methodname>register_resource</methodname>
<methodparam><type>string</type><parameter>name</parameter></methodparam>
<methodparam><type>array</type><parameter>resource_funcs</parameter></methodparam>
</methodsynopsis>
<para>
Используйте эту функцию, чтобы динамически зарегистрировать
плагин ресурса в Smarty. Передается имя ресурса и массив php-функций.
Обратитесь к <link linkend="template.resources">ресурсам шаблонов</link>
для получениядополнительной информации.
</para>
<note>
<title>Техническое замечание</title>
<para>
Имя ресурса должно состоять минимум из двух букв. Однобуквенные
имена ресурсов будут игнорироваться и испольщоваться как часть файлового
пути, например $smarty->display('c:/path/to/index.tpl');
</para>
</note>
<para>
Массив php-функций <parameter>resource_funcs</parameter>
должен содержать 4 или 5 элементов.
В случае четырех элементов, элементы являются
соответствующими коллбек-функциями: "source",
"timestamp", "secure" и "trusted" функции ресурса.
В случае пяти элементов, первый элемент должен быть
ссылкой на объект или имя класса, объект или класс которого
реализовывает ресурс, а 4 следующих элементов должны быть названиями методов,
реализующимх "source", "timestamp", "secure" и "trusted".
</para>
<example>
<title>register_resource</title>
<programlisting role="php">
<![CDATA[
<?php
$smarty->register_resource("db", array("db_get_template",
"db_get_timestamp",
"db_get_secure",
"db_get_trusted"));
?>
]]>
</programlisting>
</example>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->