mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-06 15:21:37 +01:00
124 lines
4.5 KiB
XML
124 lines
4.5 KiB
XML
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
|||
|
|
<!-- $Revision$ -->
|
|||
|
|
<sect1 id="language.function.include">
|
|||
|
|
<title>include</title>
|
|||
|
|
<informaltable frame="all">
|
|||
|
|
<tgroup cols="5">
|
|||
|
|
<colspec colname="param" align="center" />
|
|||
|
|
<colspec colname="type" align="center" />
|
|||
|
|
<colspec colname="required" align="center" />
|
|||
|
|
<colspec colname="default" align="center" />
|
|||
|
|
<colspec colname="desc" />
|
|||
|
|
<thead>
|
|||
|
|
<row>
|
|||
|
|
<entry>Nombre del Atributo</entry>
|
|||
|
|
<entry>Tipo</entry>
|
|||
|
|
<entry>requerido</entry>
|
|||
|
|
<entry>Default</entry>
|
|||
|
|
<entry>Descripci<EFBFBD>n</entry>
|
|||
|
|
</row>
|
|||
|
|
</thead>
|
|||
|
|
<tbody>
|
|||
|
|
<row>
|
|||
|
|
<entry>file</entry>
|
|||
|
|
<entry>string</entry>
|
|||
|
|
<entry>Si</entry>
|
|||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
|||
|
|
<entry>El nombre del archivo de template a Incluir.</entry>
|
|||
|
|
</row>
|
|||
|
|
<row>
|
|||
|
|
<entry>assign</entry>
|
|||
|
|
<entry>string</entry>
|
|||
|
|
<entry>No</entry>
|
|||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
|||
|
|
<entry>El nombre de una variable que contendra toda la
|
|||
|
|
salida del template.</entry>
|
|||
|
|
</row>
|
|||
|
|
<row>
|
|||
|
|
<entry>[var ...]</entry>
|
|||
|
|
<entry>[var type]</entry>
|
|||
|
|
<entry>No</entry>
|
|||
|
|
<entry><emphasis>n/a</emphasis></entry>
|
|||
|
|
<entry>Variable para pasar localmente a el template</entry>
|
|||
|
|
</row>
|
|||
|
|
</tbody>
|
|||
|
|
</tgroup>
|
|||
|
|
</informaltable>
|
|||
|
|
<para>
|
|||
|
|
Las etiquetas include son usadas para incluir otros templates en
|
|||
|
|
el template actual. Cualquier variable disponible en el template
|
|||
|
|
actual, tambi<62>n esta disponible dentro del template incluido.
|
|||
|
|
La etiqueta include debe tener el atributo "file", el cual contiene
|
|||
|
|
la ruta del archivo a incluir.
|
|||
|
|
</para>
|
|||
|
|
<para>
|
|||
|
|
Usted puede opcionalmente pasar el atributo <emphasis>assign</emphasis>,
|
|||
|
|
el cual especificara el nombre de una variable de template para el cual
|
|||
|
|
contendra toda la salida de <emphasis>include</emphasis> en vez de mostrarla.
|
|||
|
|
</para>
|
|||
|
|
<example>
|
|||
|
|
<title>funcion include</title>
|
|||
|
|
<programlisting>
|
|||
|
|
{include file="header.tpl"}
|
|||
|
|
|
|||
|
|
{* el cuerpo del template va aqui *}
|
|||
|
|
|
|||
|
|
{include file="footer.tpl"}</programlisting>
|
|||
|
|
</example>
|
|||
|
|
<para>
|
|||
|
|
Usted tambi<62>n puede pasar variables al template incluidas como
|
|||
|
|
atributos. Cualquier variable pasada al template incluidas como
|
|||
|
|
atributos estan disponibles solamente dentro el espacio del template.
|
|||
|
|
Las variables pasadas como atributos sobreescriben a las variables
|
|||
|
|
del template actual, en el caso en el que estas tengan el mismo nombre.
|
|||
|
|
</para>
|
|||
|
|
<example>
|
|||
|
|
<title>Funci<EFBFBD>n include pasando variables</title>
|
|||
|
|
<programlisting>
|
|||
|
|
{include file="header.tpl" title="Main Menu" table_bgcolor="#c0c0c0"}
|
|||
|
|
|
|||
|
|
{* el cuerpo del template va aqui *}
|
|||
|
|
|
|||
|
|
{include file="footer.tpl" logo="http://my.domain.com/logo.gif"}</programlisting>
|
|||
|
|
</example>
|
|||
|
|
<para>
|
|||
|
|
Use la sintaxis de <link linkend="template.resources">template resources</link>
|
|||
|
|
para incluir archivos fuera del directorio $template_dir.
|
|||
|
|
</para>
|
|||
|
|
<example>
|
|||
|
|
<title>Ejemplos de recursos para la funci<63>n include</title>
|
|||
|
|
<programlisting>
|
|||
|
|
{* ruta absoluta *}
|
|||
|
|
{include file="/usr/local/include/templates/header.tpl"}
|
|||
|
|
|
|||
|
|
{* ruta absoluta (lo mismo) *}
|
|||
|
|
{include file="file:/usr/local/include/templates/header.tpl"}
|
|||
|
|
|
|||
|
|
{* ruta absoluta de windows (DEBE usar el prefijo "file:") *}
|
|||
|
|
{include file="file:C:/www/pub/templates/header.tpl"}
|
|||
|
|
|
|||
|
|
{* incluir a partir del recurso de template denominado "db" *}
|
|||
|
|
{include file="db:header.tpl"}</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
|
|||
|
|
-->
|