mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-26 02:41:36 +02:00
75 lines
2.3 KiB
XML
75 lines
2.3 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision$ -->
|
|
<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>
|
|
Use esto para registrar dinámicamente un recurso de plugin con Smarty.
|
|
Pase el nombre o el recurso y o el arreglo de funciones que implementa
|
|
esto. Vea <link linkend="template.resources">template resources</link>
|
|
para mayor información de como configurar una función para mandar llamar
|
|
templates.
|
|
</para>
|
|
<note>
|
|
<title>Nota técnica</title>
|
|
<para>
|
|
El nombre del recurso debe tener al menos dos caracteres de largo.
|
|
Un nombre de recurso de un carácter será ignorado y usado como parte
|
|
del path del archivo como, $smarty->display('c:/path/to/index.tpl');
|
|
</para>
|
|
</note>
|
|
<para>
|
|
La php-funcion-array <parameter>resource_funcs</parameter> debe tener
|
|
4 o 5 elementos. Con 4 elementos los elementos son las llamadas para
|
|
las respectivas funciones de recurso "source", "timestamp", "secure"
|
|
y "trusted". Con 5 elementos el primer elemento
|
|
tiene que ser un objeto por referencia o un nombre de clase del objeto
|
|
o una clase implementando el recurso y los 4 elementos siguientes tiene
|
|
que ser los nombres de los métodos implementando "source", "timestamp",
|
|
"secure" y "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
|
|
-->
|