2004-04-13 11:47:32 +00:00
|
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
|
|
|
|
<!-- $Revision$ -->
|
2006-10-14 04:29:44 +00:00
|
|
|
|
<!-- EN-Revision: 1.1 Maintainer: nobody Status: ready -->
|
|
|
|
|
|
<sect1 id="api.register.resource">
|
2004-04-13 11:47:32 +00:00
|
|
|
|
<title>register_resource</title>
|
|
|
|
|
|
<funcsynopsis>
|
|
|
|
|
|
<funcprototype>
|
|
|
|
|
|
<funcdef>void <function>register_resource</function></funcdef>
|
|
|
|
|
|
<paramdef>string <parameter>name</parameter></paramdef>
|
|
|
|
|
|
<paramdef>array <parameter>resource_funcs</parameter></paramdef>
|
|
|
|
|
|
</funcprototype>
|
|
|
|
|
|
</funcsynopsis>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Use isso para registrar dinamicamente um recurso de plugin com a Smarty.
|
|
|
|
|
|
Passe no nome o recurso e o array de fun<75><6E>es
|
|
|
|
|
|
PHP que implementam isso. Veja
|
|
|
|
|
|
<link linkend="template.resources">template resources</link>
|
|
|
|
|
|
para maiores informa<6D><61>es de como configurar uma fun<75><6E>o para retornar
|
|
|
|
|
|
templates.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<note>
|
|
|
|
|
|
<title>Notas T<>cnicas</title>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Um nome de recurso deve ter ao menos dois caracteres de comprimento.
|
|
|
|
|
|
Um caracter do nome de recurso ir<69> ser ignorado e usado como parte do
|
|
|
|
|
|
path do arquivo como, $smarty->display('c:/path/to/index.tpl');
|
|
|
|
|
|
</para>
|
|
|
|
|
|
</note>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
A fun<75><6E>o-php-array <parameter>resource_funcs</parameter>
|
|
|
|
|
|
deve ter 4 ou 5 elementos. Com 4 elementos os elementos s<>o
|
|
|
|
|
|
as functions-callbacks para as respectivas fun<75><6E>es "source",
|
|
|
|
|
|
"timestamp", "secure" e "trusted" de recurso.
|
|
|
|
|
|
Com 5 elementos o primeiro elemento tem que ser um objeto por refer<65>ncia
|
|
|
|
|
|
ou um nome de classe do objeto ou uma classe implementando o recurso e os 4
|
|
|
|
|
|
elementos seguintes tem que ter os nomes de m<>todos
|
|
|
|
|
|
implementando "source", "timestamp",
|
|
|
|
|
|
"secure" e "trusted".
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>register_resource</title>
|
|
|
|
|
|
<programlisting>
|
|
|
|
|
|
$smarty->register_resource("db", array("db_get_template",
|
|
|
|
|
|
"db_get_timestamp",
|
|
|
|
|
|
"db_get_secure",
|
|
|
|
|
|
"db_get_trusted"));</programlisting>
|
|
|
|
|
|
</example>
|
|
|
|
|
|
</sect1>
|
|
|
|
|
|
<!-- 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
|
|
|
|
|
|
-->
|