mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-27 02:11:37 +01:00
spanish docs initial commit
This commit is contained in:
91
docs/es/programmers/plugins/plugins-compiler-functions.xml
Normal file
91
docs/es/programmers/plugins/plugins-compiler-functions.xml
Normal file
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<sect1 id="plugins.compiler.functions"><title>Funciones Compiladoras</title>
|
||||
<para>
|
||||
Las funciones compiladoras solo son llamadas durante la compilaci<63>n
|
||||
del template. Estas son <20>tiles para inyectar codigo PHP o contenido
|
||||
est<73>tico time-sensitive dentro del template. Si existen ambas, una
|
||||
funci<63>n compiladora y una funci<63>n habitual registrada bajo el mismo
|
||||
nombre, la funci<63>n compiladora tiene precedencia.
|
||||
</para>
|
||||
<funcsynopsis>
|
||||
<funcprototype>
|
||||
<funcdef>mixed <function>smarty_compiler_<replaceable>name</replaceable></function></funcdef>
|
||||
<paramdef>string <parameter>$tag_arg</parameter></paramdef>
|
||||
<paramdef>object <parameter>&$smarty</parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
En las funciones compiladoras son pasados dos par<61>metros:
|
||||
la etiqueta string del argumento de la etiqueta - basicamente,
|
||||
todo a partir del nombre de la funci<63>n hasta el delimitador del
|
||||
cierre, y el objeto del Smarty. Es supuesto que retorna el codigo
|
||||
PHP para ser inyectado dentro del template compilado.
|
||||
</para>
|
||||
<para>
|
||||
Vea tambi<62>n
|
||||
<link linkend="api.register.compiler.function">register_compiler_function()</link>,
|
||||
<link linkend="api.unregister.compiler.function">unregister_compiler_function()</link>.
|
||||
</para>
|
||||
<example>
|
||||
<title>Funci<EFBFBD>n compiladora simple</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
/*
|
||||
* Smarty plugin
|
||||
* -------------------------------------------------------------
|
||||
* File: compiler.tplheader.php
|
||||
* Type: compiler
|
||||
* Name: tplheader
|
||||
* Purpose: Output header containing the source file name and
|
||||
* the time it was compiled.
|
||||
* -------------------------------------------------------------
|
||||
*/
|
||||
function smarty_compiler_tplheader($tag_arg, &$smarty)
|
||||
{
|
||||
return "\necho '" . $smarty->_current_file . " compiled at " . date('Y-m-d H:M'). "';";
|
||||
}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Esta funci<63>n puede ser llamada en un template de la siguiente forma:
|
||||
</para>
|
||||
<programlisting>
|
||||
{* esta funci<63>n es ejecutada solamente en tiempo de compilaci<63>n *}
|
||||
{tplheader}
|
||||
</programlisting>
|
||||
<para>
|
||||
El codigo PHP resultante en el template compilado seria algo asi:
|
||||
</para>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
echo 'index.tpl compiled at 2002-02-20 20:02';
|
||||
?>
|
||||
]]>
|
||||
</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
|
||||
-->
|
||||
Reference in New Issue
Block a user