huge sync with english by the translator (Mario Ramirez)

thanks
This commit is contained in:
nlopess
2005-11-08 23:37:29 +00:00
parent d5924e7b6c
commit 9bdf158698
156 changed files with 4168 additions and 2134 deletions

View File

@@ -11,8 +11,9 @@
usted def<65>ne a una variable vacia en vez de imprimir nada, tal usted def<65>ne a una variable vacia en vez de imprimir nada, tal
como imprimir "&amp;nbsp;" a fin de que el plano del fondo de como imprimir "&amp;nbsp;" a fin de que el plano del fondo de
la tabla funcione correctamente. Muchos usarian una sentencia la tabla funcione correctamente. Muchos usarian una sentencia
{if} para manejar esto, mas existe otra forma con Smarty, usando <link linkend="language.function.if">{if}</link> para manejar esto,
el modificador de la variable <emphasis>default</emphasis>. mas existe otra forma con Smarty, usando el modificador de la variable
<link linkend="language.modifier.default"><emphasis>default</emphasis></link>.
</para> </para>
<example> <example>
<title>Imprimiendo &amp;nbsp; cuando una variable esta vacia</title> <title>Imprimiendo &amp;nbsp; cuando una variable esta vacia</title>
@@ -33,6 +34,10 @@
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambien <link linkend="language.modifier.default">default</link>
y <link linkend="tips.default.var.handling">Default Variable Handling</link>.
</para>
</sect1> </sect1>
<sect1 id="tips.default.var.handling"> <sect1 id="tips.default.var.handling">
@@ -43,7 +48,7 @@
mencionado puede evitar un bit desagradable. Usted puede mencionado puede evitar un bit desagradable. Usted puede
remediar esto con la atribuci<63>n de un valor por default a remediar esto con la atribuci<63>n de un valor por default a
la variable con la funci<63>n la variable con la funci<63>n
<link linkend="language.function.assign">assign</link>. <link linkend="language.function.assign">{assign}</link>.
</para> </para>
<example> <example>
<title>Atribuyendo el valor por default a una variable en el template</title> <title>Atribuyendo el valor por default a una variable en el template</title>
@@ -58,62 +63,79 @@ usted lo exiba *}
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Vea tambi<62>en <link linkend="language.modifier.default">default</link> y
<link linkend="tips.blank.var.handling">Blank Variable Handling</link>.
</para>
</sect1> </sect1>
<sect1 id="tips.passing.vars"> <sect1 id="tips.passing.vars">
<title>Pasando la variable titulo a la cabecera del template</title> <title>Pasando la variable titulo a la cabecera del template</title>
<para> <para>
Cuando la mayoria de sus templates usan los mismo encabezados y Cuando la mayoria de sus templates usan los mismo encabezados y
los mismos pies de pagina, es com<6F>n dividirlos uno en cada template los mismos pies de pagina, es com<6F>n dividirlos uno en cada template
y entonces incluirlos. Que pasara si el encabezado necesita tener y entonces incluirlos <link linkend="language.function.include">{include}</link>.
un titulo diferente, dependiendo de que pagina estas viniendo? Que pasara si el encabezado necesita tener un titulo diferente,
usted puede pasar el titulo en el encabezado cuando este es incluido. dependiendo de que pagina estas viniendo? usted puede pasar el
titulo en el encabezado cuando este es incluido.
</para> </para>
<example> <example>
<title>Pasando la variable titulo al encabezado del template</title> <title>Pasando la variable titulo al encabezado del template</title>
<para>
<filename>mainpage.tpl</filename>
</para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
mainpage.tpl
------------
{include file="header.tpl" title="Main Page"} {include file="header.tpl" title="Main Page"}
{* El cuerpo del template viene aqu<71> *} {* template body goes here *}
{include file="footer.tpl"} {include file="footer.tpl"}
]]>
</programlisting>
archives.tpl <para>
------------ <filename>archives.tpl</filename>
</para>
<programlisting>
<![CDATA[
{config_load file="archive_page.conf"} {config_load file="archive_page.conf"}
{include file="header.tpl" title=#archivePageTitle#} {include file="header.tpl" title=#archivePageTitle#}
{* El cuerpo del template viene aqu<71> *} {* template body goes here *}
{include file="footer.tpl"} {include file="footer.tpl"}
]]>
</programlisting>
header.tpl <para>
---------- <filename>header.tpl</filename>
<HTML> </para>
<HEAD> <programlisting>
<TITLE>{$title|default:"BC News"}</TITLE> <![CDATA[
</HEAD> <html>
<BODY> <head>
<title>{$title|default:"BC News"}</title>
</head>
footer.tpl <body>
---------- ]]>
</BODY> </programlisting>
</HTML> <para>
<filename>footer.tpl</filename>
</para>
<programlisting>
<![CDATA[
</body>
</html>
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para> <para>
Cuando la pagina principal es mostrada, el titulo de la "P<>gina Cuando la pagina principal es mostrada, el titulo de la "P<>gina
Principal" es pasado al template header.tpl, y ser<65> posteriormente Principal" es pasado al template <filename>header.tpl</filename>,
usado como el titulo. Cuando la pagina de archivo es mostrada, el y ser<65> posteriormente usado como el titulo. Cuando la pagina de archivo
titulo sera "Archivos". Observelo en el ejemplo de archivo, nosotros es mostrada, el titulo sera "Archivos". Observelo en el ejemplo de archivo,
estamos usando una variable del archivo archives_page.conf en vez de nosotros estamos usando una variable del archivo
una variable codificada rigida. Tambien note que "BC news" es mostrada <filename>archives_page.conf</filename> en vez de una variable codificada
si la variable $titulo no esta definida, usando el modificador de la rigida. Tambien note que "BC news" es mostrada si la variable $titulo no
variable <emphasis>default</emphasis>. esta definida, usando el modificador de la variable
<link linkend="language.modifier.default">default</link>.
</para> </para>
</sect1> </sect1>
<sect1 id="tips.dates"> <sect1 id="tips.dates">
@@ -129,7 +151,7 @@ footer.tpl
<para> <para>
En el Smarty 1.4.0, usted puede parsar fechas al Smarty como En el Smarty 1.4.0, usted puede parsar fechas al Smarty como
timestamps unix,mysql, o cualquier otra fecha interpretable timestamps unix,mysql, o cualquier otra fecha interpretable
por strtotime(). por <ulink url="&url.php-manual;strtotime">strtotime()</ulink>.
</para> </para>
</note> </note>
<example> <example>
@@ -169,10 +191,10 @@ Jan 4, 2001
</programlisting> </programlisting>
</example> </example>
<para> <para>
Cuando usa {html_select_date} en un template, el programador Cuando usa <link linkend="language.function.html.select.date">{html_select_date}</link>
normalmente va a querer convertir la salida de un formulario en un template, el programador normalmente va a querer convertir
de vuelta al formato timestamp. Aqu<71> esta una funci<63>n para la salida de un formulario de vuelta al formato timestamp. Aqu<71>
ayudar con esto. esta una funci<63>n para ayudar con esto.
</para> </para>
<example> <example>
<title>Convirtiendo elementos en forma de fecha de vuelta a un timestamp</title> <title>Convirtiendo elementos en forma de fecha de vuelta a un timestamp</title>
@@ -202,18 +224,28 @@ function makeTimeStamp($year="", $month="", $day="")
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Vea tambi<62>n
<link linkend="language.function.html.select.date">{html_select_date}</link>,
<link linkend="language.function.html.select.time">{html_select_time}</link>,
<link linkend="language.modifier.date.format">date_format</link>
y <link linkend="language.variables.smarty.now">$smarty.now</link>,
</para>
</sect1> </sect1>
<sect1 id="tips.wap"> <sect1 id="tips.wap">
<title>WAP/WML</title> <title>WAP/WML</title>
<para> <para>
Los templates WAP/WML requieren de un encabezado de Content-Type de Los templates WAP/WML requieren de un encabezado de
<ulink url="&url.php-manual;header">Content-Type</ulink> de
PHP para ser pasado junto con el template. La forma mas f<>cil de PHP para ser pasado junto con el template. La forma mas f<>cil de
hacer esto seria escribir una funci<63>n de manera habitual que imprima hacer esto seria escribir una funci<63>n de manera habitual que imprima
el encabezado. Si usted esta usando el sistema de cache, este no el encabezado. Si usted esta usando el sistema de
funcionara, entonces nosotros haremos esto usando una etiqueta de <link linkend="caching">cache</link>, este no funcionara, entonces
insert (recuerde que las etiquetas insert no son "cacheadas!"). nosotros haremos esto usando una etiqueta de
Asegurarse que no exista ninguna salida al navegador antes del template, <link linkend="language.function.insert">{insert}</link> (recuerde que
de otro modo el encabezado fallara. las etiquetas insert no son "cacheadas!"). Asegurarse que no exista
ninguna salida al navegador antes del template, de otro modo el encabezado fallara.
</para> </para>
<example> <example>
<title>Usando insert para escribir un encabezado WML Content-Type</title> <title>Usando insert para escribir un encabezado WML Content-Type</title>
@@ -273,12 +305,14 @@ Pretty easy isn't it?
<sect1 id="tips.componentized.templates"> <sect1 id="tips.componentized.templates">
<title>Templates con Componetes</title> <title>Templates con Componetes</title>
<para> <para>
Tradicionalmente, programar templates en sus aplicaciones sigue Tradicionalmente, programar templates en sus aplicaciones es de
esta forma: Primero, usted acumula sus variables dentro de su la siguiente forma: Primero, usted acumula sus variables dentro de su
aplicaci<63>n PHP, (talvez como requisiciones de una base de datos). aplicaci<63>n PHP, (talvez como requisiciones de una base de datos).
Entonces, usted instancia su objeto Smarty, atribuye valores a Entonces, usted instancia su objeto Smarty
las variables y muestra el template. Por ejemplo nosotros tenemos <link linkend="api.assign">assign()</link>, atribuye valores a
un registrador de existencias en nuestro template. Nosotros las variables y muestra el template
<link linkend="api.display">display()</link>. Por ejemplo nosotros
tenemos un registrador de existencias en nuestro template. Nosotros
recolectaremos los datos de las existencias en nuestra aplicaci<63>n, recolectaremos los datos de las existencias en nuestra aplicaci<63>n,
entonces damos valor a estas variables en el template y lo mostramos. entonces damos valor a estas variables en el template y lo mostramos.
Ahora esto seria genial si usted adicionara este registrador de Ahora esto seria genial si usted adicionara este registrador de
@@ -292,11 +326,16 @@ Pretty easy isn't it?
</para> </para>
<example> <example>
<title>Templates con Componetes</title> <title>Templates con Componetes</title>
<para>
<filename>function.load_ticker.php</filename> -
deja el archivo en
<link linkend="variable.plugins.dir">$plugins directory</link>
</para>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
// drop file "function.load_ticker.php" in plugin directory // deja el archivo "function.load_ticker.php" en el directorio de plugins
// configura nuestra funci&oacute;n para traer los datos almacenados // configura nuestra funci&oacute;n para traer los datos almacenados
function fetch_ticker($symbol) function fetch_ticker($symbol)
@@ -317,19 +356,23 @@ function smarty_function_load_ticker($params, &$smarty)
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para>
<filename>index.tpl</filename>
</para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
index.tpl
---------
{* Smarty *}
{load_ticker symbol="YHOO" assign="ticker"} {load_ticker symbol="YHOO" assign="ticker"}
Stock Name: {$ticker.name} Stock Price: {$ticker.price} Stock Name: {$ticker.name} Stock Price: {$ticker.price}
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Vea tambi<62>n <link linkend="language.function.include.php">{include_php}</link>,
<link linkend="language.function.include">{include}</link> y
<link linkend="language.function.php">{php}</link>.
</para>
</sect1> </sect1>
<sect1 id="tips.obfuscating.email"> <sect1 id="tips.obfuscating.email">
<title>Ofuscando direcciones de E-mail</title> <title>Ofuscando direcciones de E-mail</title>
@@ -340,14 +383,14 @@ Stock Name: {$ticker.name} Stock Price: {$ticker.price}
combatir este problema, usted puede hacer que su direccion de combatir este problema, usted puede hacer que su direccion de
E-mail aparesca en javascript mostrado en el codigo HTML, este E-mail aparesca en javascript mostrado en el codigo HTML, este
mismo aparecera y funcionara correctamente en el navegador. mismo aparecera y funcionara correctamente en el navegador.
Esto se puede hacer con el plugin mailto. Esto se puede hacer con el plugin
<link linkend="language.function.mailto">{mailto}</link>.
</para> </para>
<example> <example>
<title>Ejemplo de ofuscamiento de una direccion de E-mail</title> <title>Ejemplo de ofuscamiento de una direccion de E-mail</title>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
index.tpl {* in index.tpl *}
---------
Send inquiries to Send inquiries to
{mailto address=$EmailAddress encode="javascript" subject="Hello"} {mailto address=$EmailAddress encode="javascript" subject="Hello"}
@@ -362,6 +405,10 @@ Send inquiries to
valores, mas no es muy com<6F>n. valores, mas no es muy com<6F>n.
</para> </para>
</note> </note>
<para>
Vea tambi<62>n <link linkend="language.modifier.escape">escape</link>
y <link linkend="language.function.mailto">{mailto}</link>.
</para>
</sect1> </sect1>
</chapter> </chapter>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -49,10 +49,111 @@ Parse error: parse error in /path/to/smarty/templates_c/index.tpl.php on line 75
linea de error corresponde al script PHP compilado, no al template linea de error corresponde al script PHP compilado, no al template
en si. Normalmente usted puede en el template localizar el error de en si. Normalmente usted puede en el template localizar el error de
sinxis. Algunas cosas que usted puede buscar: falta de cierre de sinxis. Algunas cosas que usted puede buscar: falta de cierre de
etiquetas para {if}{/if} o {section}{/section}, o sintaxis de la etiquetas para <link linkend="language.function.if">{if}{/if}}</link>
l<EFBFBD>gica dentro de una etiqueta {if}. Si usted no encuentra el error, o <link linkend="language.function.if">{section}{/section}</link>, o
usted tendra que abrir el archivo PHP compilado y dirigirse al n<>mero sintaxis de la l<>gica dentro de una etiqueta {if}. Si usted no encuentra
de linea mostrado, donde el correspondiente error esta en el template. el error, usted tendra que abrir el archivo PHP compilado y dirigirse al
n<>mero de linea mostrado, donde el correspondiente error esta en el template.
</para>
<example>
<title>Otros errores comunes</title>
<itemizedlist>
<listitem>
<screen>
<![CDATA[
Warning: Smarty error: unable to read resource: "index.tpl" in...
or
Warning: Smarty error: unable to read resource: "site.conf" in...
]]>
</screen>
<para>
<itemizedlist>
<listitem>
<para>
El <link linkend="variable.template.dir">$template_dir</link>
no existe o es incorrecto, o
el archivo <filename>index.tpl</filename> no esta en la carpeta
<filename class="directory">templates/</filename>
</para>
</listitem>
<listitem>
<para>
La funci<63>n <link linkend="language.function.config.load">{config_load}</link>
esta dentro del template (o <link linkend="api.config.load">config_load()</link>
habia sido llamado) y cualquira de los dos
<link linkend="variable.config.dir">$config_dir</link>
es incorrecto, no exista o
<filename>site.conf</filename> no existe en el directorio.
</para>
</listitem>
</itemizedlist>
</para>
</listitem><listitem>
<screen>
<![CDATA[
Fatal error: Smarty error: the $compile_dir 'templates_c' does not exist,
or is not a directory...
]]>
</screen>
<para>
Cualquiera de las dos el
<link linkend="variable.compile.dir">$compile_dir</link>
es asignado incorrectamente, el directorio no existe,
o <filename>templates_c</filename> es un archivo y no un directorio.
</para>
</listitem><listitem>
<screen>
<![CDATA[
Fatal error: Smarty error: unable to write to $compile_dir '....
]]>
</screen>
<para>
El <link linkend="variable.compile.dir">$compile_dir</link>
no puede ser reescrito por el servidor web. Vea a fondo la pagina de permisos del
<link linkend="installing.smarty.basic">instalaci<EFBFBD>n de smarty</link>.
</para>
</listitem><listitem>
<screen>
<![CDATA[
Fatal error: Smarty error: the $cache_dir 'cache' does not exist,
or is not a directory. in /..
]]>
</screen>
<para>
Esto significa que
<link linkend="variable.caching">$caching</link> es habilitado y
cualquiera de los dos; el
<link linkend="variable.cache.dir">$cache_dir</link>
es asignado incorrectamente, o el directorio no existe,
o <filename>cache</filename> es un archivo y no un directorio.
</para>
</listitem><listitem>
<screen>
<![CDATA[
Fatal error: Smarty error: unable to write to $cache_dir '/...
]]>
</screen>
<para>
Esto significa que
<link linkend="variable.caching">$caching</link> es habilitado y el
<link linkend="variable.cache.dir">$cache_dir</link>
no puede ser rescrito por el web server. Ver ampliamente la pagina de permisos de
<link linkend="installing.smarty.basic">la instalacion de smarty</link>.
</para>
</listitem>
</itemizedlist>
</example>
<para>
Vea tambi<62>n
<link linkend="chapter.debugging.console">debugging</link>,
<link linkend="variable.error.reporting">$error_reporting</link>
y <link linkend="api.trigger.error">trigger_error()</link>.
</para> </para>
</sect1> </sect1>
</chapter> </chapter>

View File

@@ -8,8 +8,10 @@
las variables de archivos de configuraci<63>n de la llamada actual del las variables de archivos de configuraci<63>n de la llamada actual del
template. Incluso un template llamado "debug.tpl" viene con la template. Incluso un template llamado "debug.tpl" viene con la
distribuci<63>n de Smarty el cual controla el formateo de la consola. distribuci<63>n de Smarty el cual controla el formateo de la consola.
Defina $debugging en true en el Smarty, y si es necesario defina Defina <link linkend="variable.debugging">$debugging</link> en true en
$debug_tpl para la ruta del recurso debug.tpl (Esto es SMARTY_DIR por el Smarty, y si es necesario defina
<link linkend="variable.debug.tpl">$debug_tpl</link> para la ruta
del recurso debug.tpl (Esto es SMARTY_DIR por
default). Cuando usted carga una pagina, una consola en javascript default). Cuando usted carga una pagina, una consola en javascript
abrira una ventana popup y dara a usted el nombre de todos los templates abrira una ventana popup y dara a usted el nombre de todos los templates
incluidos y las variables definidas en la pagina actual. Para ver las incluidos y las variables definidas en la pagina actual. Para ver las
@@ -23,8 +25,10 @@
<note> <note>
<title>Nota T<>cnica</title> <title>Nota T<>cnica</title>
<para> <para>
La consola de debug no funciona cuando usted usa la API fetch(), solo La consola de debug no funciona cuando usted usa la API <link
cuando estuviera usando display(). Es un conjunto de comandos javascript linkend="api.fetch">fetch()</link>, solo cuando estuviera usando
<link linkend="api.display">display()</link>.
Es un conjunto de comandos javascript
adicionados al final del template generado. Si a usted no le gusta el adicionados al final del template generado. Si a usted no le gusta el
javascript, usted puede editar el template debug.tpl para formatear la javascript, usted puede editar el template debug.tpl para formatear la
salida como usted quiera. Los datos del debug no son guardados en cache salida como usted quiera. Los datos del debug no son guardados en cache
@@ -37,6 +41,13 @@
son en segundos, o en fracciones de segundo. son en segundos, o en fracciones de segundo.
</para> </para>
</note> </note>
<para>
Vea tambi<62>n
<link linkend="troubleshooting">troubleshooting</link>,
<link linkend="variable.error.reporting">$error_reporting</link>
y <link linkend="api.trigger.error">trigger_error()</link>.
</para>
</chapter> </chapter>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -64,10 +64,13 @@ pass=foobar
</para> </para>
<para> <para>
Los archivos de configuraci<63>n son cargados en el template con una Los archivos de configuraci<63>n son cargados en el template con una
funci<63>n incrustada <command>config_load</command>. funci<63>n incrustada <link linkend="language.function.config.load">
<command>{config_load}</command></link>.
(Ver Tambi<62>n <link linkend="api.config.load"><command>config_load()</command></link> ).
</para> </para>
<para> <para>
Usted puede esconder variables o secciones enteras colocando un punto Usted puede ocultar variables o secciones enteras colocando un punto
antes del nombre de la variable. Esto es <20>til si su aplicaci<63>n lee los antes del nombre de la variable. Esto es <20>til si su aplicaci<63>n lee los
archivos de configuraci<63>n y los datos sensibles a partir de ellos que archivos de configuraci<63>n y los datos sensibles a partir de ellos que
la herramienta del template no lo necesita. Si usted tiene a otras la herramienta del template no lo necesita. Si usted tiene a otras
@@ -75,6 +78,14 @@ pass=foobar
que ellos no leeran datos sensibles del archivo de configuraci<63>n que ellos no leeran datos sensibles del archivo de configuraci<63>n
cargando estos en el template. cargando estos en el template.
</para> </para>
<para>
Ver Tambi<62>n <link
linkend="language.function.config.load">{config_load}</link>, <link
linkend="variable.config.overwrite">$config_overwrite</link>, <link
linkend="api.get.config.vars">get_config_vars()</link>, <link
linkend="api.clear.config">clear_config()</link> y <link
linkend="api.config.load">config_load()</link>
</para>
</chapter> </chapter>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -5,7 +5,8 @@
<para> <para>
Todas las etiquetas del template deben estar marcadas por delimitadores. Todas las etiquetas del template deben estar marcadas por delimitadores.
Por default , estos delimitadores son <literal>{</literal> Por default , estos delimitadores son <literal>{</literal>
y <literal>}</literal>, sino estos pueden cambiar. y <literal>}</literal>, sino estos pueden
<link linkend="variable.left.delimiter">cambiar</link>.
</para> </para>
<para> <para>
Para estos ejemplos, nosotros asumiremos que usted est<73> usando los Para estos ejemplos, nosotros asumiremos que usted est<73> usando los
@@ -16,6 +17,7 @@
</para> </para>
&designers.language-basic-syntax.language-syntax-comments; &designers.language-basic-syntax.language-syntax-comments;
&designers.language-basic-syntax.language-syntax-variables;
&designers.language-basic-syntax.language-syntax-functions; &designers.language-basic-syntax.language-syntax-functions;
&designers.language-basic-syntax.language-syntax-attributes; &designers.language-basic-syntax.language-syntax-attributes;
&designers.language-basic-syntax.language-syntax-quotes; &designers.language-basic-syntax.language-syntax-quotes;

View File

@@ -7,7 +7,8 @@
ingonar sections o algun otro tipo analisis de sintaxis. Un ejemplo clasico ingonar sections o algun otro tipo analisis de sintaxis. Un ejemplo clasico
es con el codigo JavaScript o CSS incrustado en el template. El problema se es con el codigo JavaScript o CSS incrustado en el template. El problema se
origina cuando aquellos lenguajes que utilizan los caracteres { y } los origina cuando aquellos lenguajes que utilizan los caracteres { y } los
cuales son tambi<62>n los delimitadores por default para Smarty. cuales son tambi<62>n los <link
linkend="language.function.ldelim">delimitadores</link> por default para Smarty.
</para> </para>
<para> <para>
@@ -22,8 +23,7 @@
Similar a usar entidades HTML, usted puede usar <link Similar a usar entidades HTML, usted puede usar <link
linkend="language.function.ldelim">{ldelim}</link>,<link linkend="language.function.ldelim">{ldelim}</link>,<link
linkend="language.function.ldelim">{rdelim}</link> o <link linkend="language.function.ldelim">{rdelim}</link> o <link
linkend="language.variables.smarty.ldelim">{$smarty.ldelim}</link>,<link linkend="language.variables.smarty.ldelim">{$smarty.ldelim}</link>
linkend="language.variables.smarty.rdelim">{$smarty.rdelim}</link>
para mostrar los delimitadores actuales. para mostrar los delimitadores actuales.
</para> </para>
@@ -62,6 +62,9 @@ dosomething();
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver Tambi<62>n <link linkend="language.modifier.escape">escape modifier</link>
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -26,6 +26,11 @@
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n la funci<63>n<link linkend="language.function.math">{math}</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -3,7 +3,8 @@
<sect1 id="language.syntax.attributes"> <sect1 id="language.syntax.attributes">
<title>Atributos</title> <title>Atributos</title>
<para> <para>
La mayoria de las funciones llevan atributos que especifican o La mayoria de las <link linkend="language.syntax.functions">funciones</link>
llevan atributos que especifican o
cambian su funcionamiento. Los atributos para las funciones de cambian su funcionamiento. Los atributos para las funciones de
Smarty son muy parecidos a los atributos de HTML. Los valores Smarty son muy parecidos a los atributos de HTML. Los valores
estaticos no necesitan estar entre comillas, pero si es recomendado estaticos no necesitan estar entre comillas, pero si es recomendado
@@ -23,14 +24,16 @@
<![CDATA[ <![CDATA[
{include file="header.tpl"} {include file="header.tpl"}
{include file="header.tpl" attrib_name="attrib value"}
{include file=$includeFile} {include file=$includeFile}
{include file=#includeFile#} {include file=#includeFile# title="Smarty is cool"}
{html_select_date display_days=yes} {html_select_date display_days=yes}
<select name="company"> <select name="company">
{html_options values=$vals selected=$selected output=$output} {html_options options=$choices selected=$selected}
</select> </select>
]]> ]]>
</programlisting> </programlisting>

View File

@@ -7,25 +7,34 @@
los delimitadores, as<61>: {* este es un comentario *}. los delimitadores, as<61>: {* este es un comentario *}.
Los comentarios en Smarty no son mostrados en la salida final del Los comentarios en Smarty no son mostrados en la salida final del
template. template.
semejantes a &lt;!-- HTML comments --&gt;
Estos son usados para hacer notas internas dentro del template. Estos son usados para hacer notas internas dentro del template.
</para> </para>
<example> <example>
<title>Comentarios</title> <title>Comentarios</title>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{* Smarty *} <body>
{* this multiline
comment is
not sent to browser
*}
{* include the header file here *} {* include the header file here *}
{include file="header.tpl"} {include file="header.tpl"}
{* Dev note: $includeFile is assigned foo.php script *}
<!-- this html comment is sent to browser -->
{include file=$includeFile} {include file=$includeFile}
{include file=#includeFile#} {include file=#includeFile#}
{* display dropdown lists *} {* display dropdown lists *}
<select name="company"> <select name="company">
{html_options values=$vals selected=$selected output=$output} {html_options options=$vals selected=$selected_id}
</select> </select>
</body>
]]> ]]>
</programlisting> </programlisting>
</example> </example>

View File

@@ -6,7 +6,8 @@
Cada etiqueta Smarty muestra una Cada etiqueta Smarty muestra una
<link linkend="language.variables">variable</link> o utiliza alg<6C>n <link linkend="language.variables">variable</link> o utiliza alg<6C>n
tipo de funci<63>n. Las funciones son procesadas y mostradas colocando tipo de funci<63>n. Las funciones son procesadas y mostradas colocando
los atributos de la funci<63>n entre delimitadores, as<61>: los <link linkend="language.syntax.attributes">atributos</link> de
la funci<63>n entre delimitadores, as<61>:
{funcname attr1="val" attr2="val"}. {funcname attr1="val" attr2="val"}.
</para> </para>
<example> <example>
@@ -29,14 +30,20 @@
</example> </example>
<para> <para>
Las funciones internas y las funciones habituales, ambas deben tener Las funciones internas y las funciones habituales, ambas deben tener
la misma sintaxis dentro del template. Las funciones internas que la misma sintaxis dentro del template. Las funciones <emphasis
funcionan en Smarty, son: <command>if</command>, role="bold">internas</emphasis> que
<command>section</command> y <command>strip</command>. funcionan en Smarty, son:
Estas no pueden ser modificadas. Las funciones habituales son <link linkend="language.function.if">{if}</link>,
funciones adicionales implementadas por plugins. Estas si pueden <link linkend="language.function.section">{section}</link> y
<link linkend="language.function.strip">{strip}</link>.
Estas no pueden ser modificadas.
Las funciones habituales son
funciones <emphasis role="bold">adicionales</emphasis> implementadas
por <link linkend="plugins">plugins</link>. Estas si pueden
ser modificadas como usted quiera, o usted tambi<62>n puede ser modificadas como usted quiera, o usted tambi<62>n puede
adicionar nuevas. adicionar nuevas.
<command>html_options</command> y <command>html_select_date</command> <link linkend="language.function.html.options">{html_options}</link> y
<link linkend="language.function.popup">{popup}</link>
son ejemplos de funciones habituales. son ejemplos de funciones habituales.
</para> </para>
</sect1> </sect1>

View File

@@ -3,10 +3,14 @@
<sect1 id="language.syntax.quotes"> <sect1 id="language.syntax.quotes">
<title>Colocando variables entre comillas dobles</title> <title>Colocando variables entre comillas dobles</title>
<para> <para>
Smarty puede reconocer variables asignadas entre comillas aunque estas Smarty puede reconocer <link linkend="language.syntax.variables">variables</link>
<link linkend="api.assign">asignadas</link> entre comillas aunque estas
solo tengan n<>meros, letras, guiones bajos y corchetes[]. solo tengan n<>meros, letras, guiones bajos y corchetes[].
Con cualquier otro car<61>cter(puntos, referencia de objetos, etc.) las Con cualquier otro car<61>cter(puntos, referencia de objetos, etc.) las
variables deben estar entre apostrofos. variables deben estar entre apostrofos.
Usted no puede incrustar <link linkend="language.modifiers">modificadores</link>,
Estos deben ser siempre aplicados fuera de las comillas.
</para> </para>
<example> <example>
<title>Sintaxis entre comillas</title> <title>Sintaxis entre comillas</title>
@@ -19,6 +23,7 @@ SYNTAX EXAMPLES:
{func var="test $foo[bar] test"} <-- sees $foo[bar] {func var="test $foo[bar] test"} <-- sees $foo[bar]
{func var="test $foo.bar test"} <-- sees $foo (not $foo.bar) {func var="test $foo.bar test"} <-- sees $foo (not $foo.bar)
{func var="test `$foo.bar` test"} <-- sees $foo.bar {func var="test `$foo.bar` test"} <-- sees $foo.bar
{func var="test `$foo.bar` test"|escape} <-- modifiers outside quotes!
PRACTICAL EXAMPLES: PRACTICAL EXAMPLES:
{include file="subdir/$tpl_name.tpl"} <-- will replace $tpl_name with value {include file="subdir/$tpl_name.tpl"} <-- will replace $tpl_name with value
@@ -26,6 +31,10 @@ PRACTICAL EXAMPLES:
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n <link linkend="language.modifier.escape">escape</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -4,13 +4,15 @@
<sect1 id="language.syntax.variables"> <sect1 id="language.syntax.variables">
<title>Variables</title> <title>Variables</title>
<para> <para>
Las variable de Template que comiencen con signo de pesos. Pueden contener n<>meros, Las variable de Template que comiencen con signo de pesos.
letras y guiones bajos, muy parecido a las variables de PHP. Usted tambi<62>n puede Pueden contener n<>meros, letras y guiones bajos, muy parecido a
hacer referencia a arreglos que puden ser numericos o no-numericos. Tambi<62>n las <ulink url="&url.php-manual;language.variables">variables de PHP</ulink>.
puede hacer referencia a m<EFBFBD>todos y propiedades de objetos. Config file Usted tambi<62>n puede hacer referencia a arreglos que puden ser numericos o
variables es una excepci<63>n de la sintaxis del signo de pesos. no-numericos. Tambi<62>n puede hacer referencia a m<>todos y propiedades de objetos.
Tambi<EFBFBD>n puede ser referenciado entre signos de numeros, o con la <link linkend="language.config.variables">Config file variables</link> es una
variable especial $smarty.config. excepci<EFBFBD>n de la sintaxis del signo de pesos.
Tambi<62>n puede ser referenciado entre #signos de numeros#, o con la
variable especial <link linkend="language.variables.smarty.config">$smarty.config</link>.
</para> </para>
<example> <example>
<title>Variables</title> <title>Variables</title>
@@ -25,6 +27,7 @@
{#foo#} <-- display the config file variable "foo" {#foo#} <-- display the config file variable "foo"
{$smarty.config.foo} <-- synonym for {#foo#} {$smarty.config.foo} <-- synonym for {#foo#}
{$foo[bar]} <-- syntax only valid in a section loop, see {section} {$foo[bar]} <-- syntax only valid in a section loop, see {section}
{assign var=foo value="baa"}{$foo} <-- displays "baa", see {assign}
Many other combinations are allowed Many other combinations are allowed
@@ -38,6 +41,10 @@ Many other combinations are allowed
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Vea tambi<62>n <link linkend="language.variables.smarty">$smarty reserved variables</link>
y <link linkend="language.config.variables">Config Variables</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -38,12 +38,14 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
capture es usado para recolectar toda la salida del template en una {capture} es usado para recolectar toda la salida del template en una
variable en lugar de mostrarla. variable en lugar de mostrarla.
Cualquier contenido entre {capture name="foo"} y {/capture} es Cualquier contenido entre {capture name="foo"} y {/capture} es
recoletado en una variable especificada y el atributo name. El recoletado en una variable especificada y el atributo name. El
contenido capturado puede ser usado en el template a partir de la contenido capturado puede ser usado en el template a partir de la
variable especial $smarty.capture.foo en donde foo es el valor variable especial
<link linkend="language.variables.smarty.capture">$smarty.capture.foo</link>
en donde foo es el valor
pasado para el atributo name. Si usted no pasa un atributo name, pasado para el atributo name. Si usted no pasa un atributo name,
entonces ser<65> usado "default". Todos lo comandos {capture} deben entonces ser<65> usado "default". Todos lo comandos {capture} deben
estar entre {/capture}. Usted puede anidar(colocar uno dentro de estar entre {/capture}. Usted puede anidar(colocar uno dentro de
@@ -61,9 +63,10 @@
<caution> <caution>
<para> <para>
Tenga cuidado cuando capture la salida del comando Tenga cuidado cuando capture la salida del comando
<command>insert</command>. Si tuviera activo el cache y tuviera <link linkend="language.function.insert">{insert}</link>.
comandos <command>insert</command> y usted espera que funcione Si tuviera activo el <link linkend="caching">cache</link> y tuviera
con contenido de cache, no se capturara este contenido. comandos <link linkend="language.function.insert">{insert}</link> y
usted espera que funcione con contenido de cache, no se capturara este contenido.
</para> </para>
</caution> </caution>
<para> <para>
@@ -87,6 +90,15 @@
</programlisting> </programlisting>
</example> </example>
</para> </para>
<para>
Ver Tambi<62>n
<link linkend="language.variables.smarty.capture">$smarty.capture</link>,
<link linkend="language.function.eval">{eval}</link>,
<link linkend="language.function.fetch">{fetch}</link>,
<link linkend="api.fetch">fetch()</link>
y <link linkend="language.function.assign">{assign}</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -64,19 +64,39 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
Esta funci<63>n es usada para cargar las variables de un archivo de Esta funci<63>n es usada para cargar las <link
configuraci<EFBFBD>n dentro de un template. linkend="language.config.variables">#variables#</link>
de un archivo de configuraci<63>n dentro de un template.
Vea <link linkend="config.files">Config Files</link> para mayor Vea <link linkend="config.files">Config Files</link> para mayor
informaci<63>n. informaci<63>n.
</para> </para>
<example> <example>
<title>funci<EFBFBD>n config_load</title> <title>Funci<EFBFBD>n {config_load}</title>
<para>
ejemplo.conf
</para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{config_load file="colors.conf"} #this is config file comment
# global variables
pageTitle = "Main Menu"
bodyBgColor = #000000
tableBgColor = #000000
rowBgColor = #00ff00
#customer variables section
[Customer]
pageTitle = "Customer Info"
]]>
</programlisting>
<para>y el template</para>
<programlisting>
<![CDATA[
{config_load file="example.conf"}
<html> <html>
<title>{#pageTitle#}</title> <title>{#pageTitle#|default:"No title"}</title>
<body bgcolor="{#bodyBgColor#}"> <body bgcolor="{#bodyBgColor#}">
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}"> <table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
<tr bgcolor="{#rowBgColor#}"> <tr bgcolor="{#rowBgColor#}">
@@ -91,23 +111,24 @@
</programlisting> </programlisting>
</example> </example>
<para> <para>
Los archivos de configuraci<63>n pueden contener secciones tambi<62>n. Los <link linkend="config.files">archivos de configuraci<63>n</link>
Usted puede cargar variables de una secci<63>n adicionando el atributo pueden contener secciones tambi<62>n. Usted puede cargar variables de
<emphasis>section</emphasis>. una secci<63>n adicionando el atributo <emphasis>'section'</emphasis>.
</para> </para>
<note> <note>
<para> <para>
<emphasis>Config file sections</emphasis> es la funci<63>n integrada <emphasis>Config file sections</emphasis> es la funci<63>n integrada
de template <emphasis>section</emphasis> no tiene nada que ver de template <link
uno con el otro, ellos justamente por casualidad tiene en com<6F>n el linkend="language.function.section"><emphasis>{section}</emphasis></link>
convensionalismo del nombre. no tiene nada que ver uno con el otro, ellos justamente por casualidad
tiene en com<6F>n el convensionalismo del nombre.
</para> </para>
</note> </note>
<example> <example>
<title>Funci<EFBFBD>n config_load con section</title> <title>Funci<EFBFBD>n config_load con section</title>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{config_load file="colors.conf" section="Customer"} {config_load file="ejemplo.conf" section="Customer"}
<html> <html>
<title>{#pageTitle#}</title> <title>{#pageTitle#}</title>
@@ -124,6 +145,13 @@
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Vea tambi<62>n <link linkend="config.files">Config files</link>,
<link linkend="language.config.variables">Config variables</link>,
<link linkend="variable.config.dir">$config_dir</link>,
<link linkend="api.get.config.vars">get_config_vars()</link>
y <link linkend="api.config.load">config_load()</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.foreach"> <sect1 id="language.function.foreach">
<title>foreach,foreachelse</title> <title>{foreach},{foreachelse}</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -24,8 +24,7 @@
<entry>array</entry> <entry>array</entry>
<entry>Si</entry> <entry>Si</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>El nombre de la matriz a la que usted estara pegando <entry>El nombre de la matriz a la que usted estara pegando los elementos</entry>
los elementos</entry>
</row> </row>
<row> <row>
<entry>item</entry> <entry>item</entry>
@@ -54,8 +53,9 @@
</informaltable> </informaltable>
<para> <para>
Los ciclos(loop) <emphasis>foreach</emphasis> son una alternativa para loop Los ciclos(loop) <emphasis>foreach</emphasis> son una alternativa para loop
<emphasis>section</emphasis>. <emphasis>foreach</emphasis> es usado para pegar <link linkend="language.function.section"><emphasis>{section}</emphasis></link>.
cada elemento de una matriz asociativa simple. <emphasis>foreach</emphasis> es usado para pegar cada elemento de una
<emphasis role="bold">matriz asociativa simple</emphasis>.
La sintaxis para <emphasis>foreach</emphasis> es mucho mas simple que La sintaxis para <emphasis>foreach</emphasis> es mucho mas simple que
<emphasis>section</emphasis>, pero tiene una desventaja de que solo puede ser <emphasis>section</emphasis>, pero tiene una desventaja de que solo puede ser
usada en una <20>nica matriz. usada en una <20>nica matriz.
@@ -73,64 +73,115 @@
</para> </para>
<example> <example>
<title>foreach</title> <title>foreach</title>
<programlisting> <programlisting role="php">
<![CDATA[
<?php
$arr = array( 1001,1002,1003);
$smarty->assign('custid', $arr);
?>
]]>
</programlisting>
<programlisting>
<![CDATA[
{* este ejemplo muestra todos los valores de la matriz $custid *} {* este ejemplo muestra todos los valores de la matriz $custid *}
{foreach from=$custid item=curr_id} {foreach from=$custid item=curr_id}
id: {$curr_id}&lt;br&gt; id: {$curr_id}<br />
{/foreach} {/foreach}
]]>
SALIDA: </programlisting>
<para>
id: 1000&lt;br&gt; Esta es la salida del ejemplo de arriba:
id: 1001&lt;br&gt; </para>
id: 1002&lt;br&gt;</programlisting> <screen>
<![CDATA[
id: 1000<br />
id: 1001<br />
id: 1002<br />
]]>
</screen>
</example> </example>
<example> <example>
<title>foreach key</title> <title>foreach key</title>
<programlisting role="php">
<![CDATA[
// La llave contiene la llave para cada valor del ciclo(loop)
//asignacion fisica de esta manera:
<?php
$smarty->assign('contacts', array(
array('phone' => '1',
'fax' => '2',
'cell' => '3'),
array('phone' => '555-4444',
'fax' => '555-3333',
'cell' => '760-1234')
));
?>
]]>
</programlisting>
<programlisting> <programlisting>
{* La llave contiene la llave para cada valor del ciclo(loop) <![CDATA[
asignacion fisica de esta manera:
$smarty->assign("contacts", array(array("phone" =&gt; "1", "fax" =&gt; "2", "cell" =&gt; "3"),
array("phone" =&gt; "555-4444", "fax" =&gt; "555-3333", "cell" =&gt; "760-1234")));
*}
{foreach name=outer item=contact from=$contacts} {foreach name=outer item=contact from=$contacts}
<hr />
{foreach key=key item=item from=$contact} {foreach key=key item=item from=$contact}
{$key}: {$item}&lt;br&gt; {$key}: {$item}<br />
{/foreach} {/foreach}
{/foreach} {/foreach}
]]>
SALIDA: </programlisting>
<para>
phone: 1&lt;br&gt; Esta es la salida del ejemplo de arriba:
fax: 2&lt;br&gt; </para>
cell: 3&lt;br&gt; <screen>
phone: 555-4444&lt;br&gt; <![CDATA[
fax: 555-3333&lt;br&gt; <hr />
cell: 760-1234&lt;br&gt;</programlisting> phone: 1<br />
fax: 2<br />
cell: 3<br />
<hr />
phone: 555-4444<br />
fax: 555-3333<br />
cell: 760-1234<br />
]]>
</screen>
</example>
<example>
<title>Ejemplo de {foreach} - con base de datos (eg PEAR o ADODB)</title>
<programlisting role="php">
<![CDATA[
<?php
$sql = 'select contact_id, name, nick from contacts order by contact';
$smarty->assign("contacts", $db->getAssoc($sql));
?>
]]>
</programlisting>
<programlisting>
<![CDATA[
{foreach key=cid item=con from=$contacts}
<a href="contact.php?contact_id={$cid}">{$con.name} - {$con.nick}</a><br />
{/foreach}
]]>
</programlisting>
</example> </example>
<para> <para>
El ciclo(Loop) foreach tambi<62>n tiene sus propias variables para El ciclo(Loop) foreach tambi<62>n tiene sus propias variables para
manipular las propiedades del foreach. manipular las propiedades del foreach.
Estas son indicadas as<61>: {$smarty.foreach.foreachname.varname} con Estas son indicadas as<61>:
foreachname siendo el nombre especificado del atributo <link linkend="language.variables.smarty.loops">{$smarty.foreach.foreachname.varname}</link>
con foreachname siendo el nombre especificado del atributo
<emphasis>name</emphasis> del foreach. <emphasis>name</emphasis> del foreach.
</para> </para>
<para>Ver <link linkend="section.property.index">{section}</link>
para ejemplos ide las propiedades bajo las cuales son identicos.
</para>
<sect2 id="foreach.property.iteration"> <sect2 id="foreach.property.iteration">
<title>iteration</title> <title>iteration</title>
<para> <para>
iteration es usado para mostrar la interaci<63>n actual del ciclo(loop). iteration es usado para mostrar la interaci<63>n actual del ciclo(loop).
</para> iteration siempre comienza en 1 incrementado en uno cada interaci<63>n.
<para>
iteration siempre comienza en 1 incrementado uno a uno en cada interaci<63>nn.
</para> </para>
</sect2> </sect2>
@@ -166,13 +217,14 @@ cell: 760-1234&lt;br&gt;</programlisting>
<emphasis>total</emphasis> Es usado para mostrar el n<>mero de interaciones <emphasis>total</emphasis> Es usado para mostrar el n<>mero de interaciones
del foreach. Este puede ser usado dentro o despu<70>s de el. del foreach. Este puede ser usado dentro o despu<70>s de el.
</para> </para>
<para>
Ver tambien <link linkend="language.function.section">{section}</link> y
<link linkend="language.variables.smarty.loops">$smarty.foreach</link>.
</para>
</sect2> </sect2>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
mode: sgml mode: sgml

View File

@@ -3,10 +3,12 @@
<sect1 id="language.function.if"> <sect1 id="language.function.if">
<title>if,elseif,else</title> <title>if,elseif,else</title>
<para> <para>
Los comandos if del Smarty tiene mucho de la flexibilidad del comando Los comandos <emphasis>{if}</emphasis> del Smarty tiene mucho de la
if de php, con algunas adiciones para la herramienta de template. flexibilidad del comando
<ulink url="&url.php-manual;if"><command>if</command></ulink> de php,
con algunas adiciones para la herramienta de template.
Todo <emphasis>{if}</emphasis> debe tener su <emphasis>{/if}</emphasis>. Todo <emphasis>{if}</emphasis> debe tener su <emphasis>{/if}</emphasis>.
<emphasis>{else}</emphasis> y <emphasis>{elseif}</emphasis> tambien son <emphasis>{else}</emphasis> y <emphasis>{elseif}</emphasis> tambi<EFBFBD>n son
permitidos. permitidos.
Toda las condicionales de PHP son reconcidas, tal como Toda las condicionales de PHP son reconcidas, tal como
<emphasis>||</emphasis>, <emphasis>or</emphasis>, <emphasis>||</emphasis>, <emphasis>or</emphasis>,
@@ -79,6 +81,13 @@
<entry>menor que o igual</entry> <entry>menor que o igual</entry>
<entry>&lt;=</entry> <entry>&lt;=</entry>
</row> </row>
<row>
<entry>===</entry>
<entry></entry>
<entry>$a === 0</entry>
<entry>Igual e indentico</entry>
<entry>===</entry>
</row>
<row> <row>
<entry>!</entry> <entry>!</entry>
<entry>not</entry> <entry>not</entry>
@@ -134,6 +143,7 @@
<example> <example>
<title>sentencia if</title> <title>sentencia if</title>
<programlisting> <programlisting>
<![CDATA[
{if $name eq "Fred"} {if $name eq "Fred"}
Welcome Sir. Welcome Sir.
{elseif $name eq "Wilma"} {elseif $name eq "Wilma"}
@@ -160,7 +170,7 @@
{* los parentesis son permitidos *} {* los parentesis son permitidos *}
{if ( $amount &lt; 0 or $amount &gt; 1000 ) and $volume >= #minVolAmt#} {if ( $amount < 0 or $amount > 1000 ) and $volume >= #minVolAmt#}
... ...
{/if} {/if}
@@ -194,7 +204,9 @@
{* 0=even, 1=even, 2=even, 3=odd, 4=odd, 5=odd, etc. *} {* 0=even, 1=even, 2=even, 3=odd, 4=odd, 5=odd, etc. *}
{if $var is even by 3} {if $var is even by 3}
... ...
{/if}</programlisting> {/if}
]]>
</programlisting>
</example> </example>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.include.php"> <sect1 id="language.function.include.php">
<title>include_php</title> <title>{include_php}</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -48,34 +48,27 @@
<note> <note>
<title>Nota t<>cnica</title> <title>Nota t<>cnica</title>
<para> <para>
include_php es muy desaprovechado desde Smarty, usted puede {include_php} es muy desaprovechado desde Smarty, usted puede
lograr la misma funcionalidad por medio de las funciones de lograr la misma funcionalidad por medio de las funciones de
costumbre del template. costumbre del template.
La unica raz<61>n para usar include_php es si usted en realidad tiene La unica raz<61>n para usar {include_php} es si usted en realidad tiene
la necesidad de poner en cuarentna la funcion de php fuera del la necesidad de poner en cuarentena la funcion de php fuera del
directorio de plugin y su codigo de la aplicaci<63>n. directorio de <link linkend="variable.plugins.dir">plugins</link> y
su codigo de la aplicaci<63>n.
Vea un <link linkend="tips.componentized.templates">ejemplo</link> Vea un <link linkend="tips.componentized.templates">ejemplo</link>
de templates componentizados para detalles. de templates componentizados para detalles.
</para> </para>
</note> </note>
<para> <para>
Las etiquetas include_php son usadas para incluir un script PHP Las etiquetas {include_php} son usadas para incluir un script PHP
dentro de su template. Si la seguridad estuviera activada, entonces dentro de su template. <link linkend="variable.security">
el script PHP debe estar localizado en la ruta $trusted_dir. Si la seguridad estuviera activada</link>, entonces
el script PHP debe estar localizado en la ruta <link
linkend="variable.trusted.dir">$trusted_dir</link>.
La etiqueta include_php debe tener el atributo "file", el cual La etiqueta include_php debe tener el atributo "file", el cual
contiene la ruta del archivo PHP a ser incluido, o el relativo contiene la ruta del archivo PHP a ser incluido, o el relativo
al $trusted_dir, o una ruta absoluta. al <link linkend="variable.trusted.dir">$trusted_dir</link>, o
</para> una ruta absoluta.
<para>
include_php es un buen medio para manipular templates con componentes,
y mantiene el c<>digo PHP separado de los archivos del template.
Vamos adecir que usted tenga un template que muestre la navegaci<63>n de
su sitio, el cual es tirado autom<6F>ticamente a partir de una base de
datos. Usted puede mantener su l<>gica de PHP que obtiene los datos en
un directorio separado, e incluirla arriba del template. Ahora usted
puede incluir este template en cualquier lugar sin preocuparse si la
informaci<63>n de la base de datos fue obtenida por la aplicaci<63>n antes
de usarla.
</para> </para>
<para> <para>
Por default, los archivos son incluidos solo una vez a un cuando son Por default, los archivos son incluidos solo una vez a un cuando son
@@ -87,19 +80,18 @@
<para> <para>
Usted puede opcionalmente pasar el atributo <emphasis>assign</emphasis>, Usted puede opcionalmente pasar el atributo <emphasis>assign</emphasis>,
el cual especificara una variable del template la cual contendra toda la el cual especificara una variable del template la cual contendra toda la
salida del <emphasis>include_php</emphasis> en vez de mostrarla. salida del <emphasis>{include_php}</emphasis> en vez de mostrarla.
</para> </para>
<para> <para>
El objeto smarty esta disponible como $this dentro del script php que usted El objeto smarty esta disponible como $this dentro del script php que usted
incluyo. incluyo.
</para> </para>
<example> <example>
<title>funcion include_php</title> <title>funcion {include_php}</title>
<programlisting> <para>load_nav.php</para>
load_nav.php <programlisting role="php">
------------- <![CDATA[
<?php
&lt;?php
// carga variables de una base de datos mysql y def<65>ne esta para el template // carga variables de una base de datos mysql y def<65>ne esta para el template
require_once("MySQL.class.php"); require_once("MySQL.class.php");
@@ -107,18 +99,31 @@ load_nav.php
$sql->query("select * from site_nav_sections order by name",SQL_ALL); $sql->query("select * from site_nav_sections order by name",SQL_ALL);
$this->assign('sections',$sql->record); $this->assign('sections',$sql->record);
?&gt; ?>
]]>
</programlisting>
index.tpl <para>
--------- Donde index.tpl es:
</para>
<programlisting>
<![CDATA[
{* ruta absoluta o relativa del $trusted_dir *} {* ruta absoluta o relativa del $trusted_dir *}
{include_php file="/path/to/load_nav.php"} {include_php file="/path/to/load_nav.php"}
{foreach item="curr_section" from=$sections} {foreach item="curr_section" from=$sections}
&lt;a href="{$curr_section.url}"&gt;{$curr_section.name}&lt;/a&gt;&lt;br&gt; <a href="{$curr_section.url}">{$curr_section.name}</a><br />
{/foreach}</programlisting> {/foreach}
]]>
</programlisting>
</example> </example>
<para>
Ver tambi<62>n <link linkend="language.function.include">{include}</link>,
<link linkend="language.function.php">{php}</link>, <link
linkend="language.function.capture">{capture}</link>, <link
linkend="template.resources">Template Resources</link> y <link
linkend="tips.componentized.templates">Componentized Templates</link>
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -45,25 +45,36 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
Las etiquetas include son usadas para incluir otros templates en Las etiquetas {include} son usadas para incluir otros templates en
el template actual. Cualquier variable disponible en el template el template actual. Cualquier variable disponible en el template
actual, tambi<62>n esta disponible dentro del template incluido. actual, tambi<62>n esta disponible dentro del template incluido.
La etiqueta include debe tener el atributo "file", el cual contiene La etiqueta {include} debe tener el atributo "file", el cual contiene
la ruta del archivo a incluir. la ruta del archivo a incluir.
</para> </para>
<para> <para>
Usted puede opcionalmente pasar el atributo <emphasis>assign</emphasis>, Usted puede opcionalmente pasar el atributo <emphasis>'assign'</emphasis>,
el cual especificara el nombre de una variable de template para el cual 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. contendra toda la salida de {include} en vez de mostrarla.
</para> </para>
<example> <example>
<title>funcion include</title> <title>funcion {include}</title>
<programlisting> <programlisting>
{include file="header.tpl"} <![CDATA[
<html>
<head>
<title>{$title}</title>
</head>
<body>
{include file="page_header.tpl"}
{* el cuerpo del template va aqui *} {* el cuerpo del template va aqui *}
{include file="/$tpl_name.tpl"} <-- will replace $tpl_name with value
{include file="footer.tpl"}</programlisting> {include file="page_footer.tpl"}
</body>
</html>
]]>
</programlisting>
</example> </example>
<para> <para>
Usted tambi<62>n puede pasar variables al template incluidas como Usted tambi<62>n puede pasar variables al template incluidas como
@@ -73,21 +84,60 @@
del template actual, en el caso en el que estas tengan el mismo nombre. del template actual, en el caso en el que estas tengan el mismo nombre.
</para> </para>
<example> <example>
<title>Funci<EFBFBD>n include pasando variables</title> <title>Funci<EFBFBD>n {include} pasando variables</title>
<programlisting> <programlisting>
<![CDATA[
{include file="header.tpl" title="Main Menu" table_bgcolor="#c0c0c0"} {include file="header.tpl" title="Main Menu" table_bgcolor="#c0c0c0"}
{* el cuerpo del template va aqui *} {* el cuerpo del template va aqui *}
{include file="footer.tpl" logo="http://my.domain.com/logo.gif"}</programlisting> {include file="footer.tpl" logo="http://my.example.com/logo.gif"}
]]>
</programlisting>
<para>Donde header.tpl puede ser</para>
<programlisting>
<![CDATA[
<table border='1' width='100%' bgcolor='{$table_bgcolor|default:"#0000FF"}'>
<tr><td>
<h1>{$title}</h1>
</td></tr>
</table>
]]>
</programlisting>
</example> </example>
<example>
<title>{include} y asignacion de variables</title>
<para>En este ejemplo asignan el contenido de nav.tpl en la variable $navbar,
entonces la salida hasta arriba y hasta abajo de pagina.
</para>
<programlisting>
<![CDATA[
<body>
{include file="nav.tpl" assign="navbar"}
{include file="header.tpl" title="Main Menu" table_bgcolor="#c0c0c0"}
{$navbar}
{* el cuerpo del template va aqui *}
{include file="footer.tpl" logo="http://my.example.com/logo.gif"}
{$navbar}
</body>
]]>
</programlisting>
</example>
<para> <para>
Use la sintaxis de <link linkend="template.resources">template resources</link> Use la sintaxis de <link linkend="template.resources">template resources</link>
para incluir archivos fuera del directorio $template_dir. para incluir archivos fuera del directorio
<link linkend="variable.template.dir">$template_dir</link>.
</para> </para>
<example> <example>
<title>Ejemplos de recursos para la funci<63>n include</title> <title>Ejemplos de recursos para la funci<63>n include</title>
<programlisting> <programlisting>
<![CDATA[
{* ruta absoluta *} {* ruta absoluta *}
{include file="/usr/local/include/templates/header.tpl"} {include file="/usr/local/include/templates/header.tpl"}
@@ -98,7 +148,17 @@
{include file="file:C:/www/pub/templates/header.tpl"} {include file="file:C:/www/pub/templates/header.tpl"}
{* incluir a partir del recurso de template denominado "db" *} {* incluir a partir del recurso de template denominado "db" *}
{include file="db:header.tpl"}</programlisting> {include file="db:header.tpl"}
]]>
</programlisting>
<para>
ver tambi<62>n
<link linkend="language.function.include.php">{include_php}</link>,
<link linkend="language.function.php">{php}</link>,
<link linkend="template.resources">Template Resources</link> y
<link linkend="tips.componentized.templates">Componentized Templates</link>.
</para>
</example> </example>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -53,7 +53,8 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
La etiqueta funciona parecido a las etiquetas include, excepto La etiqueta funciona parecido a las etiquetas <link
linkend="language.function.include">{include}</link>, excepto
que las etiquetas insert no van para el cache cuando que las etiquetas insert no van para el cache cuando
<link linkend="caching">caching</link> esta activado. <link linkend="caching">caching</link> esta activado.
Esta sera executada a cada invocaci<63>n del template. Esta sera executada a cada invocaci<63>n del template.
@@ -63,15 +64,17 @@
de la pagina. El banner puede contener cualquier mezcla de HTML, imagenes, de la pagina. El banner puede contener cualquier mezcla de HTML, imagenes,
flash, etc. As<41> nosotros no podemos usar una liga(link) estatica aqu<71>, flash, etc. As<41> nosotros no podemos usar una liga(link) estatica aqu<71>,
y nosotros no queremos que este el contenido oculto con la pagina. y nosotros no queremos que este el contenido oculto con la pagina.
Aqu<71> vemos la etiqueta insert: el template conoce los valores Aqu<71> vemos la etiqueta {insert}: el template conoce los valores
#banner_location_id# y #site_id# (obtenidos de un archivo de configuraci<63>n), #banner_location_id# y #site_id# (obtenidos de un <link
linkend="config.files">archivo de configuraci<63>n</link>),
y necesita llamar una funci<63>n para obtener el contenido del banner. y necesita llamar una funci<63>n para obtener el contenido del banner.
</para> </para>
<example> <example>
<title>funci<EFBFBD>n insert</title> <title>funci<EFBFBD>n {insert}</title>
<programlisting> <programlisting>
{* ejemplo de traer un banner *} {* ejemplo de traer un banner *}
{insert name="getBanner" lid=#banner_location_id# sid=#site_id#}</programlisting> {insert name="getBanner" lid=#banner_location_id# sid=#site_id#}
</programlisting>
</example> </example>
<para> <para>
En este ejemplo, nosotros estamos usando el nombre "getBanner" En este ejemplo, nosotros estamos usando el nombre "getBanner"
@@ -90,17 +93,19 @@
</para> </para>
<para> <para>
Si usted proporciona el atributo "assign", la salida de la etiqueta Si usted proporciona el atributo "assign", la salida de la etiqueta
insert ser<65> dada a esta variable en vez de ser una salida en el template. {insert} ser<65> dada a esta variable en vez de ser una salida en el template.
Nota: definir la salida a una variable no es util cuando el cache esta Nota: definir la salida a una variable no es util cuando el <link
activo. linkend="variable.caching">cache</link> esta habilitado.
</para> </para>
<para> <para>
Si usted proporciona el atributo "script", este script php ser<65> Si usted proporciona el atributo "script", este script php ser<65>
incluido (solo una vez) antes de la ejecuci<63>n de la funci<63>n insert. incluido (solo una vez) antes de la ejecuci<63>n de la funci<63>n {insert}.
Este es el caso donde la funci<63>n insert no exista todavia, y el Este es el caso donde la funci<63>n insert no exista todavia, y el
script php debe ser incluido antes para que pueda funcionar. script php debe ser incluido antes para que pueda funcionar.
La ruta puede ser absuluta o relativa a $trusted_dir. La ruta puede ser absuluta o relativa a <link
Cuando la seguridad esta activada, el script debe estar en $trusted_dir. linkend="variable.trusted.dir">$trusted_dir</link>.
Cuando <link linkend="variable.security">la seguridad esta activada</link>,
el script debe estar en <link linkend="variable.trusted.dir">$trusted_dir</link>.
</para> </para>
<para> <para>
El objeto Smarty es pasado como segundo argumento. De este modo El objeto Smarty es pasado como segundo argumento. De este modo

View File

@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.ldelim"> <sect1 id="language.function.ldelim">
<title>ldelim,rdelim</title> <title>{ldelim},{rdelim}</title>
<para> <para>
ldelim y rdelim son usados para escapar delimitadores en el template, {ldelim} y {rdelim} son usados para
<link linkend="language.escaping">escapar</link> delimitadores en el template,
en nuestro caso "{" or "}". Usted puede usar solo en nuestro caso "{" or "}". Usted puede usar solo
<link linkend="language.function.literal">{literal}{/literal}</link> para <link linkend="language.function.literal">{literal}{/literal}</link> para
escapar bloques de texto. escapar bloques de texto.
Vea tambien <link linkend="language.variables.smarty.ldelim">{$smarty.ldelim}</link> Vea tambien <link linkend="language.variables.smarty.ldelim">{$smarty.ldelim}</link>.
y <link linkend="language.variables.smarty.rdelim">{$smarty.rdelim}</link>
</para> </para>
<example> <example>
<title>ldelim, rdelim</title> <title>{ldelim}, {rdelim}</title>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{* Esto mostrara los delimitadores del template *} {* Esto mostrara los delimitadores del template *}
@@ -27,7 +27,31 @@
{funcname} is how functions look in Smarty! {funcname} is how functions look in Smarty!
]]> ]]>
</screen> </screen>
<para>Otros ejemplos con algunos javascript</para>
<programlisting>
<![CDATA[
<script language="JavaScript">
function foo() {ldelim}
... code ...
{rdelim}
</script>
]]>
</programlisting>
<para>
esta es la salida
</para>
<screen>
<![CDATA[
<script language="JavaScript">
function foo() {
.... code ...
}
</script>
]]>
</screen>
</example> </example>
<para>Vea tambi<62>n <link linkend="language.escaping">Escaping Smarty Parsing</link> </para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -4,22 +4,14 @@
<title>literal</title> <title>literal</title>
<para> <para>
Las etiquetas literal permiten que un block de datos sea tomado literalmente, Las etiquetas literal permiten que un block de datos sea tomado literalmente,
no siendo interpretado por el smarty. no siendo interpretado por el smarty. Esto es generalmente utilizado alrededor
Esto es util para cosas como secciones de javascript, en donde pueden de bloques javascript o stylesheet, en donde pueden haber sintaxis
haber llaves ("{}") <link linkend="variable.left.delimiter">delimitadoras</link> que puedan
y cosas asi que puedan confundir al interpretador del template. interferir con el template.
Cualquier cosa dentro las {literal}{/literal} no ser&aacute;
interpretado, y sera mostrado tal como esta.
Las etiquetas literal permiten que un bloque de datos sea tomado
literalmente, este es tipicamente usado en ambiente javascript o
stylesheet bloques donde las llaves interfieren con los delimitadores
de sintaxis de Samrty.
Cualquer cosa dentro de las etiquetas {literal}{/literal} no es Cualquer cosa dentro de las etiquetas {literal}{/literal} no es
interpretado, si no desplegado tal como esta. Si usted necesita en su interpretado, si no desplegado tal como esta. Si usted necesita en su
template etiquetas empotradas en su bloque de literal, considere usar template etiquetas incrustadas en su bloque de literal, considere usar
<link linkend="language.function.ldelim">{ldelim}{rdelim}</link> para <link linkend="language.function.ldelim">{ldelim}{rdelim}</link> para
escapar delimitadores individuales en lugar de eso. escapar delimitadores individuales en lugar de eso.
</para> </para>
@@ -47,6 +39,9 @@
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n <link linkend="language.escaping">Escaping Smarty Parsing</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -1,22 +1,40 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.php"> <sect1 id="language.function.php">
<title>php</title> <title>{php}</title>
<para> <para>
Las etiquetas php permiten que usted adicione c<>digo php directamente Las etiquetas {php} permiten a suetdd incrustar c<>digo php directamente
en el template. No ser<65> escapado, no importando la definici<63>n de en el template. No ser<65> escapado, no importando la definici<63>n de
<link linkend="variable.php.handling">$php_handling</link>. <link linkend="variable.php.handling">$php_handling</link>.
Esto es solo para usuario avanzados y normalmente no es necesario. Esto es solo para usuario avanzados y normalmente no es necesario.
</para> </para>
<example> <example>
<title>Etiqueta php</title> <title>Etiqueta {php}</title>
<programlisting> <programlisting role="php">
<![CDATA[
{php} {php}
// incluyendo un script php // incluyendo un script php
// directamente en el template. // directamente en el template.
include("/path/to/display_weather.php"); include("/path/to/display_weather.php");
{/php}</programlisting> {/php}
]]>
</programlisting>
</example> </example>
<note>
<title>Nota t<>cnica</title>
<para>
Para poder tener acceso a las variables de PHP puede ser necesario usar la palabra clave
<ulink url="&url.php-manual;global">global</ulink> de PHP.
</para>
</note>
<para>
ver Tambi<62>n
<link linkend="variable.php.handling">$php_handling</link>,
<link linkend="language.function.include.php">{include_php}</link>,
<link linkend="language.function.include">{include}</link> y
<link linkend="tips.componentized.templates">Componentized Templates</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -28,11 +28,10 @@
</row> </row>
<row> <row>
<entry>loop</entry> <entry>loop</entry>
<entry>[$variable_name]</entry> <entry>mixed</entry>
<entry>Si</entry> <entry>Si</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>El nombre de la variable para determinar el n<>mero de <entry>El nombre de la variable para determinar el n<>mero de iteracciones</entry>
iteracciones</entry>
</row> </row>
<row> <row>
<entry>start</entry> <entry>start</entry>
@@ -76,7 +75,9 @@
</informaltable> </informaltable>
<para> <para>
Las section del template son usada para realizar un ciclo(loop) de Las section del template son usada para realizar un ciclo(loop) de
un arreglo de datos. Todas las etiquetas <emphasis>section</emphasis> un <emphasis role="bold">arreglo de datos</emphasis>.
(al agiual que un <link linkend="language.function.foreach">{foreach}</link>).
Todas las etiquetas <emphasis>section</emphasis>
deben tener su par <emphasis>/section</emphasis>. Los par<61>metros deben tener su par <emphasis>/section</emphasis>. Los par<61>metros
requeridos son <emphasis>name</emphasis> y <emphasis>loop</emphasis>. requeridos son <emphasis>name</emphasis> y <emphasis>loop</emphasis>.
El nombre de la section puede ser el que usted quiera, formado por El nombre de la section puede ser el que usted quiera, formado por
@@ -91,23 +92,89 @@
</para> </para>
<example> <example>
<title>section</title> <title>section</title>
<programlisting role="php">
<![CDATA[
<?php
$data = array(1000,1001,1002);
$smarty->assign('custid',$data);
?>
]]>
</programlisting>
<programlisting> <programlisting>
<![CDATA[
{* este ejemplo muestra todos los valores del arreglo $custid *} {* this example will print out all the values of the $custid array *}
{section name=customer loop=$custid} {section name=customer loop=$custid}
id: {$custid[customer]}&lt;br&gt; id: {$custid[customer]}<br />
{/section} {/section}
<hr />
SALIDA: {* print out all the values of the $custid array reversed *}
{section name=foo loop=$custid step=-1}
id: 1000&lt;br&gt; {$custid[foo]}<br />
id: 1001&lt;br&gt; {/section}
id: 1002&lt;br&gt;</programlisting> ]]>
</programlisting>
<para>
The above example will output:
</para>
<screen>
<![CDATA[
id: 1000<br />
id: 1001<br />
id: 1002<br />
<hr />
id: 1002<br />
id: 1001<br />
id: 1000<br />
]]>
</screen>
<para>
Otro par de ejemplos sin un arreglo asignado.
</para>
<programlisting>
<![CDATA[
{section name=foo start=10 loop=20 step=2}
{$smarty.section.foo.index}
{/section}
<hr />
{section name=bar loop=21 max=6 step=-2}
{$smarty.section.bar.index}
{/section}
]]>
</programlisting>
<para>
Esta es la salida del ejemplo de arriba:
</para>
<screen>
<![CDATA[
10 12 14 16 18
<hr />
20 18 16 14 12 10
]]>
</screen>
</example> </example>
<example> <example>
<title>loop(ciclo) de la variable section</title> <title>loop(ciclo) de la variable section</title>
<programlisting role="php">
<![CDATA[
<?php
$id = array(1001,1002,1003);
$smarty->assign('custid',$id);
$fullnames = array('John Smith','Jack Jones','Jane Munson');
$smarty->assign('name',$fullnames);
$addr = array('253 N 45th', '417 Mulberry ln', '5605 apple st');
$smarty->assign('address',$addr);
?>
]]>
</programlisting>
<programlisting> <programlisting>
<![CDATA[
{* la variable del loop solo determina el n<>mero de veces del ciclo. {* la variable del loop solo determina el n<>mero de veces del ciclo.
Usted puede accesar a cualquier variable del template dentro de la section. Usted puede accesar a cualquier variable del template dentro de la section.
Este ejemplo asume que $custid, $name y $address son todas matrizes Este ejemplo asume que $custid, $name y $address son todas matrizes
@@ -118,125 +185,237 @@ id: 1002&lt;br&gt;</programlisting>
address: {$address[customer]}&lt;br&gt; address: {$address[customer]}&lt;br&gt;
&lt;p&gt; &lt;p&gt;
{/section} {/section}
]]>
</programlisting>
SALIDA: <para>
La salida del ajemplo de arriba:
id: 1000&lt;br&gt; </para>
name: John Smith&lt;br&gt; <screen>
address: 253 N 45th&lt;br&gt; <![CDATA[
&lt;p&gt; <p>
id: 1001&lt;br&gt; id: 1000<br />
name: Jack Jones&lt;br&gt; name: John Smith<br />
address: 417 Mulberry ln&lt;br&gt; address: 253 N 45th
&lt;p&gt; </p>
id: 1002&lt;br&gt; <p>
name: Jane Munson&lt;br&gt; id: 1001<br />
address: 5605 apple st&lt;br&gt; name: Jack Jones<br />
&lt;p&gt;</programlisting> address: 417 Mulberry ln
</p>
<p>
id: 1002<br />
name: Jane Munson<br />
address: 5605 apple st
</p>
]]>
</screen>
</example> </example>
<example> <example>
<title>Nombres de section</title> <title>Nombres de section</title>
<programlisting> <programlisting>
{* El nombre de la section puede ser el que usted quiera, <![CDATA[
y es usado para referenciar los datos dentro de una section *} {*
{section name=mydata loop=$custid} El nombre de la section puede ser el que usted quiera,
id: {$custid[mydata]}&lt;br&gt; y es usado para referenciar los datos dentro de una section
name: {$name[mydata]}&lt;br&gt; *}
address: {$address[mydata]}&lt;br&gt; {section name=anything loop=$custid}
&lt;p&gt; <p>
{/section}</programlisting> id: {$custid[anything]}<br />
name: {$name[anything]}<br />
address: {$address[anything]}
</p>
{/section}
]]>
</programlisting>
</example> </example>
<example> <example>
<title>sections anidadas</title> <title>sections anidadas</title>
<programlisting role="php">
<![CDATA[
<?php
$id = array(1001,1002,1003);
$smarty->assign('custid',$id);
$fullnames = array('John Smith','Jack Jones','Jane Munson');
$smarty->assign('name',$fullnames);
$addr = array('253 N 45th', '417 Mulberry ln', '5605 apple st');
$smarty->assign('address',$addr);
$types = array(
array( 'home phone', 'cell phone', 'e-mail'),
array( 'home phone', 'web'),
array( 'cell phone')
);
$smarty->assign('contact_type', $types);
$info = array(
array('555-555-5555', '666-555-5555', 'john@myexample.com'),
array( '123-456-4', 'www.example.com'),
array( '0457878')
);
$smarty->assign('contact_info', $info);
?>
]]>
</programlisting>
<programlisting> <programlisting>
<![CDATA[
{* Las sections pueden ser anidados tan profundamente como usted quiera. {* Las sections pueden ser anidados tan profundamente como usted quiera.
Con las sections anidadas, usted puede accesar a estructuras complejas, Con las sections anidadas, usted puede accesar a estructuras complejas,
como una matriz multi-dimensional. En este ejemplo, $contact_type[customer] como una matriz multi-dimensional. En este ejemplo, $contact_type[customer]
es una matriz de tipos de contacto para el cliente actual. *} es una matriz de tipos de contacto para el cliente actual. *}
{section name=customer loop=$custid} {section name=customer loop=$custid}
id: {$custid[customer]}&lt;br&gt; <hr>
name: {$name[customer]}&lt;br&gt; id: {$custid[customer]}<br />
address: {$address[customer]}&lt;br&gt; name: {$name[customer]}<br />
address: {$address[customer]}<br />
{section name=contact loop=$contact_type[customer]} {section name=contact loop=$contact_type[customer]}
{$contact_type[customer][contact]}: {$contact_info[customer][contact]}&lt;br&gt; {$contact_type[customer][contact]}: {$contact_info[customer][contact]}<br />
{/section} {/section}
&lt;p&gt;
{/section} {/section}
]]>
</programlisting>
SALIDA: <para>
la salida del ejemplo de arriba:
id: 1000&lt;br&gt; </para>
name: John Smith&lt;br&gt; <screen>
address: 253 N 45th&lt;br&gt; <![CDATA[
home phone: 555-555-5555&lt;br&gt; <hr>
cell phone: 555-555-5555&lt;br&gt; id: 1000<br />
e-mail: john@mydomain.com&lt;br&gt; name: John Smith<br />
&lt;p&gt; address: 253 N 45th<br />
id: 1001&lt;br&gt; home phone: 555-555-5555<br />
name: Jack Jones&lt;br&gt; cell phone: 666-555-5555<br />
address: 417 Mulberry ln&lt;br&gt; e-mail: john@myexample.com<br />
home phone: 555-555-5555&lt;br&gt; <hr>
cell phone: 555-555-5555&lt;br&gt; id: 1001<br />
e-mail: jack@mydomain.com&lt;br&gt; name: Jack Jones<br />
&lt;p&gt; address: 417 Mulberry ln<br />
id: 1002&lt;br&gt; home phone: 123-456-4<br />
name: Jane Munson&lt;br&gt; web: www.example.com<br />
address: 5605 apple st&lt;br&gt; <hr>
home phone: 555-555-5555&lt;br&gt; id: 1002<br />
cell phone: 555-555-5555&lt;br&gt; name: Jane Munson<br />
e-mail: jane@mydomain.com&lt;br&gt; address: 5605 apple st<br />
&lt;p&gt;</programlisting> cell phone: 0457878<br />
]]>
</screen>
</example> </example>
<example> <example>
<title>sections y matrices asociativas</title> <title>sections y matrices asociativas</title>
<programlisting role="php">
<![CDATA[
<?php
$data = array(
array('name' => 'John Smith', 'home' => '555-555-5555',
'cell' => '666-555-5555', 'email' => 'john@myexample.com'),
array('name' => 'Jack Jones', 'home' => '777-555-5555',
'cell' => '888-555-5555', 'email' => 'jack@myexample.com'),
array('name' => 'Jane Munson', 'home' => '000-555-5555',
'cell' => '123456', 'email' => 'jane@myexample.com')
);
$smarty->assign('contacts',$data);
?>
]]>
</programlisting>
<programlisting> <programlisting>
{* Este es un ejemplo que muestra los datos de una matriz asociativa <![CDATA[
dentro de una section *} {*
Este es un ejemplo que muestra los datos de una matriz asociativa
dentro de una section
*}
{section name=customer loop=$contacts} {section name=customer loop=$contacts}
name: {$contacts[customer].name}&lt;br&gt; <p>
home: {$contacts[customer].home}&lt;br&gt; name: {$contacts[customer].name}<br />
cell: {$contacts[customer].cell}&lt;br&gt; home: {$contacts[customer].home}<br />
e-mail: {$contacts[customer].email}&lt;p&gt; cell: {$contacts[customer].cell}<br />
e-mail: {$contacts[customer].email}
</p>
{/section} {/section}
]]>
</programlisting>
<para>
Esta es la salida del ejemplo de arriba:
</para>
<screen>
<![CDATA[
<p>
name: John Smith<br />
home: 555-555-5555<br />
cell: 666-555-5555<br />
e-mail: john@myexample.com
</p>
<p>
name: Jack Jones<br />
home phone: 777-555-5555<br />
cell phone: 888-555-5555<br />
e-mail: jack@myexample.com
</p>
<p>
name: Jane Munson<br />
home phone: 000-555-5555<br />
cell phone: 123456<br />
e-mail: jane@myexample.com
</p>
]]>
</screen>
<para>Ejemplo usando una base de datos(eg usando Pear o Adodb)</para>
<programlisting role="php">
<![CDATA[
<?php
$sql = 'select id, name, home, cell, email from contacts';
$smarty->assign('contacts',$db->getAll($sql) );
SALIDA: ?>
]]>
</programlisting>
name: John Smith&lt;br&gt; <programlisting>
home: 555-555-5555&lt;br&gt; <![CDATA[
cell: 555-555-5555&lt;br&gt; {*
e-mail: john@mydomain.com&lt;p&gt; salida de la base de datos, resultado en una tabla
name: Jack Jones&lt;br&gt; *}
home phone: 555-555-5555&lt;br&gt; <table>
cell phone: 555-555-5555&lt;br&gt; <tr><th>&nbsp;</th><th>Name></th><th>Home</th><th>Cell</th><th>Email</th></tr>
e-mail: jack@mydomain.com&lt;p&gt; {section name=co loop=$contacts}
name: Jane Munson&lt;br&gt; <tr>
home phone: 555-555-5555&lt;br&gt; <td><a href="view.php?id={$contacts[co].id}">view<a></td>
cell phone: 555-555-5555&lt;br&gt; <td>{$contacts[co].name}</td>
e-mail: jane@mydomain.com&lt;p&gt;</programlisting> <td>{$contacts[co].home}</td>
<td>{$contacts[co].cell}</td>
<td>{$contacts[co].email}</td>
<tr>
{/section}
</table>
]]>
</programlisting>
</example> </example>
<example> <example>
<title>sectionelse</title> <title>{sectionelse}</title>
<programlisting> <programlisting>
<![CDATA[
{* sectionelse se ejecutara si no hubieran valores en $custid *} {* sectionelse se ejecutara si no hubieran valores en $custid *}
{section name=customer loop=$custid} {section name=customer loop=$custid}
id: {$custid[customer]}&lt;br&gt; id: {$custid[customer]}<br />
{sectionelse} {sectionelse}
there are no values in $custid. there are no values in $custid.
{/section}</programlisting> {/section}
]]>
</programlisting>
</example> </example>
<para> <para>
Las sections tambi<62>n tiene sus propias variables que manipulan las Las sections tambi<62>n tiene sus propias variables que manipulan las
propiedades de section. Estas son indicadas asi: propiedades de section. Estas son indicadas asi:
{$smarty.section.sectionname.varname} <link linkend="language.variables.smarty.loops">{$smarty.section.sectionname.varname}</link>
</para> </para>
<note> <note>
<para> <para>
@@ -258,55 +437,43 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
<title>Nota Tecnica</title> <title>Nota Tecnica</title>
<para> <para>
Si las propiedades de paso y comienzo del section son modificadas, Si las propiedades de paso y comienzo del section son modificadas,
entonces estas funcionan igual a las propiedades de iteration de la entonces estas funcionan igual a las propiedades de
<link linkend="section.property.iteration">iteration</link> de la
section, exepto que comienzan en 0 en vez de 1. section, exepto que comienzan en 0 en vez de 1.
</para> </para>
</note> </note>
<example> <example>
<title> section propiedades del index</title> <title>{section} propiedades del index</title>
<programlisting> <programlisting>
<![CDATA[
{* FYI, $custid[customer.index] y $custid[customer] are identical in meaning *}
{section name=customer loop=$custid} {section name=customer loop=$custid}
{$smarty.section.customer.index} id: {$custid[customer]}&lt;br&gt; {$smarty.section.customer.index} id: {$custid[customer]}<br />
{/section} {/section}
]]>
SALIDA:
0 id: 1000&lt;br&gt;
1 id: 1001&lt;br&gt;
2 id: 1002&lt;br&gt;
</programlisting> </programlisting>
<para>
salida del ejemplo de arriba:
</para>
<screen>
<![CDATA[
0 id: 1000<br />
1 id: 1001<br />
2 id: 1002<br />
]]>
</screen>
</example> </example>
</sect2> </sect2>
<sect2 id="section.property.index.prev"> <sect2 id="section.property.index.prev">
<title>index_prev</title> <title>index_prev</title>
<para> <para>
El index_prev es usado para mostrar el <20>ndice anterior del loop(ciclo). El index_prev es usado para mostrar el <20>ndice anterior del loop(ciclo).
del primer loop(ciclo) esto es definido como -1. del primer loop(ciclo) esto es definido como -1.
</para> </para>
<example>
<title>section propiedades del index_prev</title>
<programlisting>
{section name=customer loop=$custid}
{$smarty.section.customer.index} id: {$custid[customer]}&lt;br&gt;
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
{if $custid[customer.index_prev] ne $custid[customer.index]}
The customer id changed&lt;br&gt;
{/if}
{/section}
SALIDA:
0 id: 1000&lt;br&gt;
The customer id changed&lt;br&gt;
1 id: 1001&lt;br&gt;
The customer id changed&lt;br&gt;
2 id: 1002&lt;br&gt;
The customer id changed&lt;br&gt;
</programlisting>
</example>
</sect2> </sect2>
<sect2 id="section.property.index.next"> <sect2 id="section.property.index.next">
<title>index_next</title> <title>index_next</title>
<para> <para>
@@ -315,28 +482,53 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
la definici<63>n del atributo step que se a dado.) la definici<63>n del atributo step que se a dado.)
</para> </para>
<example> <example>
<title>section propiedades del index_next</title> <title>{section} propiedades del index_next y index_prev</title>
<programlisting> <programlisting role="php">
{section name=customer loop=$custid} <![CDATA[
{$smarty.section.customer.index} id: {$custid[customer]}&lt;br&gt; <?php
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *}
{if $custid[customer.index_next] ne $custid[customer.index]}
The customer id will change&lt;br&gt;
{/if}
{/section}
$data = array(1001,1002,1003,1004,1005);
$smarty->assign('custid',$data);
SALIDA: ?>
]]>
0 id: 1000&lt;br&gt;
The customer id will change&lt;br&gt;
1 id: 1001&lt;br&gt;
The customer id will change&lt;br&gt;
2 id: 1002&lt;br&gt;
The customer id will change&lt;br&gt;
</programlisting> </programlisting>
<programlisting>
<![CDATA[
{* FYI, $custid[cus.index] and $custid[cus] are identical in meaning *}
<table>
<tr>
<th>index</th><th>id</th>
<th>index_prev</th><th>prev_id</th>
<th>index_next</th><th>next_id</th>
</tr>
{section name=cus loop=$custid}
<tr>
<td>{$smarty.section.cus.index}</td><td>{$custid[cus]}</td>
<td>{$smarty.section.cus.index_prev}</td><td>{$custid[cus.index_prev]}</td>
<td>{$smarty.section.cus.index_next}</td><td>{$custid[cus.index_next]}</td>
</tr>
{/section}
</table>
]]>
</programlisting>
<para>
la salida del ejemplo de arriba esta contenido en la siguiente tabla:
</para>
<screen>
<![CDATA[
index id index_prev prev_id index_next next_id
0 1001 -1 1 1002
1 1002 0 1001 2 1003
2 1003 1 1002 3 1004
3 1004 2 1003 4 1005
4 1005 3 1004 5
]]>
</screen>
</example> </example>
</sect2> </sect2>
<sect2 id="section.property.iteration"> <sect2 id="section.property.iteration">
<title>iteration</title> <title>iteration</title>
<para> <para>
@@ -345,125 +537,130 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
<note> <note>
<para> <para>
Esto no es afectado por las propiedades del section start, step y max, Esto no es afectado por las propiedades del section start, step y max,
distinto de las propriedades del index. Iteration tambi<62>n comineza con distinto de las propriedades del <link linkend="section.property.index">index</link>.
1 en vez de 0 como index. rownum es un alias de iteration, estas funcionan Iteration tambi<62>n comineza con 1 en vez de 0 como index.
de manera identica. <link linkend="section.property.rownum">rownum</link> es un alias de iteration,
estas funcionan de manera identica.
</para> </para>
</note> </note>
<example> <example>
<title>section propiedades de iteration</title> <title>{section} propiedades de iteration</title>
<programlisting role="php">
<![CDATA[
<?php
// array of 3000 to 3015
$id = range(3000,3015);
$smarty->assign('custid',$id);
?>
]]>
</programlisting>
<programlisting> <programlisting>
{section name=customer loop=$custid start=5 step=2} <![CDATA[
current loop iteration: {$smarty.section.customer.iteration}&lt;br&gt; {section name=cu loop=$custid start=5 step=2}
{$smarty.section.customer.index} id: {$custid[customer]}&lt;br&gt; iteration={$smarty.section.cu.iteration}
{* FYI, $custid[customer.index] and $custid[customer] are identical in meaning *} index={$smarty.section.cu.index}
{if $custid[customer.index_next] ne $custid[customer.index]} id={$custid[cu]}<br />
The customer id will change&lt;br&gt;
{/if}
{/section} {/section}
]]>
</programlisting>
SALIDA: <para>
salida del ejemplo de arriba:
current loop iteration: 1 </para>
5 id: 1000&lt;br&gt; <screen>
The customer id will change&lt;br&gt; <![CDATA[
current loop iteration: 2 iteration=1 index=5 id=3005<br />
7 id: 1001&lt;br&gt; iteration=2 index=7 id=3007<br />
The customer id will change&lt;br&gt; iteration=3 index=9 id=3009<br />
current loop iteration: 3 iteration=4 index=11 id=3011<br />
9 id: 1002&lt;br&gt; iteration=5 index=13 id=3013<br />
The customer id will change&lt;br&gt; iteration=6 index=15 id=3015<br />
]]>
</screen>
<para>
Este ejemplo utiliza la propiedad iteration para salida a una tabla
bloqueando el encabezado para cada 5 renglones
(utilice <link linkend="language.function.if">{if}</link> con el operador mod).
</para>
<programlisting>
<![CDATA[
<table>
{section name=co loop=$contacts}
{if $smarty.section.co.iteration % 5 == 1}
<tr><th>&nbsp;</th><th>Name></th><th>Home</th><th>Cell</th><th>Email</th></tr>
{/if}
<tr>
<td><a href="view.php?id={$contacts[co].id}">view<a></td>
<td>{$contacts[co].name}</td>
<td>{$contacts[co].home}</td>
<td>{$contacts[co].cell}</td>
<td>{$contacts[co].email}</td>
<tr>
{/section}
</table>
]]>
</programlisting> </programlisting>
</example> </example>
</sect2> </sect2>
<sect2 id="section.property.first"> <sect2 id="section.property.first">
<title>first</title> <title>first</title>
<para> <para>
first es definido como true se la iteraci<EFBFBD>n actual de la section es la primera. first es definido como true se la
<link linkend="section.property.iteration">iteraci<EFBFBD>n</link>
actual de la section es la primera.
</para> </para>
<example>
<title>section propiedades de first</title>
<programlisting>
{section name=customer loop=$custid}
{if $smarty.section.customer.first}
&lt;table&gt;
{/if}
&lt;tr&gt;&lt;td&gt;{$smarty.section.customer.index} id:
{$custid[customer]}&lt;/td&gt;&lt;/tr&gt;
{if $smarty.section.customer.last}
&lt;/table&gt;
{/if}
{/section}
SALIDA:
&lt;table&gt;
&lt;tr&gt;&lt;td&gt;0 id: 1000&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;1 id: 1001&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;2 id: 1002&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
</programlisting>
</example>
</sect2> </sect2>
<sect2 id="section.property.last"> <sect2 id="section.property.last">
<title>last</title> <title>last</title>
<para> <para>
last es definido como true si la iteraci<EFBFBD>n actual del section es la ultima. last es definido como true si la
<link linkend="section.property.iteration">iteraci<EFBFBD>n</link>
actual del section es la ultima.
</para> </para>
<example> <example>
<title>section propiedades de last</title> <title>{section} propiedades first y last</title>
<para>
En este ciclo de ejemplo el arreglo $customer, en la salida es bloqueado
el encabezado en la primera iteracion y en la ultima la salida es bloqueda
para el pie de pagina.
(Utilice la propiedad section <link linkend="section.property.total">total</link>)
</para>
<programlisting> <programlisting>
{section name=customer loop=$custid} <![CDATA[
{section name=customer loop=$customers}
{if $smarty.section.customer.first} {if $smarty.section.customer.first}
&lt;table&gt; <table>
<tr><th>id</th><th>customer</th></tr>
{/if} {/if}
&lt;tr&gt;&lt;td&gt;{$smarty.section.customer.index} id: <tr>
{$custid[customer]}&lt;/td&gt;&lt;/tr&gt; <td>{$customers[customer].id}}</td>
<td>{$customers[customer].name}</td>
</tr>
{if $smarty.section.customer.last} {if $smarty.section.customer.last}
&lt;/table&gt; <tr><td></td><td>{$smarty.section.customer.total} customers</td></tr>
</table>
{/if} {/if}
{/section} {/section}
]]>
SALIDA:
&lt;table&gt;
&lt;tr&gt;&lt;td&gt;0 id: 1000&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;1 id: 1001&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;2 id: 1002&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;
</programlisting> </programlisting>
</example> </example>
</sect2> </sect2>
<sect2 id="section.property.rownum"> <sect2 id="section.property.rownum">
<title>rownum</title> <title>rownum</title>
<para> <para>
rownum es usado para mostrar la interaci<63>n actual del loop(ciclo), rownum es usado para mostrar la interaci<63>n actual del loop(ciclo),
comenzando con 1. Es un alias para iteration, estas funcionan de comenzando con 1. Es un alias para
modo identico. <link linkend="section.property.iteration">iteration</link>, estas
funcionan de modo identico.
</para> </para>
<example>
<title> section propiedades de rownum</title>
<programlisting>
{section name=customer loop=$custid}
{$smarty.section.customer.rownum} id: {$custid[customer]}&lt;br&gt;
{/section}
SALIDA:
1 id: 1000&lt;br&gt;
2 id: 1001&lt;br&gt;
3 id: 1002&lt;br&gt;
</programlisting>
</example>
</sect2> </sect2>
<sect2 id="section.property.loop"> <sect2 id="section.property.loop">
<title>loop</title> <title>loop</title>
<para> <para>
@@ -471,24 +668,31 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
loop(ciclo) de esta section. Esto puede ser usado dentro o fuera del section. loop(ciclo) de esta section. Esto puede ser usado dentro o fuera del section.
</para> </para>
<example> <example>
<title>section propiedades de index</title> <title>{section} propiedades de index</title>
<programlisting> <programlisting>
<![CDATA[
{section name=customer loop=$custid} {section name=customer loop=$custid}
{$smarty.section.customer.index} id: {$custid[customer]}&lt;br&gt; {$smarty.section.customer.index} id: {$custid[customer]}<br />
{/section} {/section}
There were {$smarty.section.customer.loop} customers shown above. There were {$smarty.section.customer.loop} customers shown above.
]]>
SALIDA: </programlisting>
<para>
0 id: 1000&lt;br&gt; La salida del ejemplo de arriba:
1 id: 1001&lt;br&gt; </para>
2 id: 1002&lt;br&gt; <screen>
<![CDATA[
0 id: 1000<br />
1 id: 1001<br />
2 id: 1002<br />
There were 3 customers shown above. There were 3 customers shown above.
</programlisting> ]]>
</screen>
</example> </example>
</sect2> </sect2>
<sect2 id="section.property.show"> <sect2 id="section.property.show">
<title>show</title> <title>show</title>
<para> <para>
@@ -500,10 +704,13 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
<example> <example>
<title>section atributos de show</title> <title>section atributos de show</title>
<programlisting> <programlisting>
{* $show_customer_info debe ser pasado de la aplicacion PHP, <![CDATA[
para regular cuando mostrar o no esta section shows*} {*
$show_customer_info debe ser pasado de la aplicacion PHP,
para regular cuando mostrar o no esta section shows
*}
{section name=customer loop=$custid show=$show_customer_info} {section name=customer loop=$custid show=$show_customer_info}
{$smarty.section.customer.rownum} id: {$custid[customer]}&lt;br&gt; {$smarty.section.customer.rownum} id: {$custid[customer]}<br />
{/section} {/section}
{if $smarty.section.customer.show} {if $smarty.section.customer.show}
@@ -511,18 +718,23 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
{else} {else}
the section was not shown. the section was not shown.
{/if} {/if}
]]>
</programlisting>
SALIDA: <para>
La salida del ejemplo de arriba:
1 id: 1000&lt;br&gt; </para>
2 id: 1001&lt;br&gt; <screen>
3 id: 1002&lt;br&gt; <![CDATA[
1 id: 1000<br />
2 id: 1001<br />
3 id: 1002<br />
the section was shown. the section was shown.
</programlisting> ]]>
</screen>
</example> </example>
</sect2> </sect2>
<sect2 id="section.property.total"> <sect2 id="section.property.total">
<title>total</title> <title>total</title>
<para> <para>
@@ -530,25 +742,36 @@ e-mail: jane@mydomain.com&lt;p&gt;</programlisting>
section tendra. Este puede ser usado dentro o fuera del section. section tendra. Este puede ser usado dentro o fuera del section.
</para> </para>
<example> <example>
<title>section propiedades de total</title> <title>{section} propiedades de total</title>
<programlisting> <programlisting>
<![CDATA[
{section name=customer loop=$custid step=2} {section name=customer loop=$custid step=2}
{$smarty.section.customer.index} id: {$custid[customer]}&lt;br&gt; {$smarty.section.customer.index} id: {$custid[customer]}<br />
{/section} {/section}
There were {$smarty.section.customer.total} customers shown above. There were {$smarty.section.customer.total} customers shown above.
]]>
SALIDA: </programlisting>
<para>
0 id: 1000&lt;br&gt; The above example will output:
2 id: 1001&lt;br&gt; </para>
4 id: 1002&lt;br&gt; <screen>
<![CDATA[
0 id: 1000<br />
2 id: 1002<br />
4 id: 1004<br />
There were 3 customers shown above. There were 3 customers shown above.
</programlisting> ]]>
</screen>
</example> </example>
<para>
Ver tambi<62>n <link linkend="language.function.foreach">{foreach}</link>
y <link linkend="language.variables.smarty.loops">$smarty.section</link>.
</para>
</sect2> </sect2>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
mode: sgml mode: sgml

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.strip"> <sect1 id="language.function.strip">
<title>strip</title> <title>{strip}</title>
<para> <para>
Muchas veces el dise<73>ador de web tiene problemas con los espacios en Muchas veces el dise<73>ador de web tiene problemas con los espacios en
blanco y retornos de carro que afectan la salida del HTML blanco y retornos de carro que afectan la salida del HTML
@@ -20,16 +20,16 @@
<title>Nota T<>cnica</title> <title>Nota T<>cnica</title>
<para> <para>
{strip}{/strip} no afeta el contenido de las variables del template. {strip}{/strip} no afeta el contenido de las variables del template.
Vea <link linkend="language.modifier.strip">strip modifier function</link>. Vea la funci<63>n <link linkend="language.modifier.strip">strip modifier</link>.
</para> </para>
</note> </note>
<example> <example>
<title>strip tags</title> <title>{strip} tags</title>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{* El siguiente c<>digo se ejecutara todo junto en una sola linea de salida *} {* El siguiente c<>digo se ejecutara todo junto en una sola linea de salida *}
{strip} {strip}
<table border=0> <table border='0'>
<tr> <tr>
<td> <td>
<A HREF="{$url}"> <A HREF="{$url}">
@@ -39,13 +39,16 @@
</tr> </tr>
</table> </table>
{/strip} {/strip}
SALIDA:
<table border=0><tr><td><A HREF="http://my.domain.com"><font color="red">This is a test</font></A></td></tr></table>
]]> ]]>
</programlisting> </programlisting>
<para>
salida del ejemplo de arriba:
</para>
<screen>
<![CDATA[
<table border=0><tr><td><A HREF="http://w... snipped...</td></tr></table>
]]>
</screen>
</example> </example>
<para> <para>
Note que en el ejemplo de arriba, todas las lineas comienzan y termina Note que en el ejemplo de arriba, todas las lineas comienzan y termina
@@ -54,6 +57,9 @@ SALIDA:
o en el final de una linea, este estaria junto, y puede no ser el o en el final de una linea, este estaria junto, y puede no ser el
resultado deseado. resultado deseado.
</para> </para>
<para>
Vea Tambi<62>n <link linkend="language.modifier.strip">strip modifier</link>
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -11,15 +11,18 @@
<title>Combinando Modificadores</title> <title>Combinando Modificadores</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
index.php:
<?php <?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Smokers are Productive, but Death Cuts Efficiency.'); $smarty->assign('articleTitle', 'Smokers are Productive, but Death Cuts Efficiency.');
$smarty->display('index.tpl');
?> ?>
]]>
index.tpl: </programlisting>
<para>
Donde el template es:
</para>
<programlisting>
<![CDATA[
{$articleTitle} {$articleTitle}
{$articleTitle|upper|spacify} {$articleTitle|upper|spacify}
{$articleTitle|lower|spacify|truncate} {$articleTitle|lower|spacify|truncate}
@@ -33,8 +36,8 @@ index.tpl:
<screen> <screen>
<![CDATA[ <![CDATA[
Smokers are Productive, but Death Cuts Efficiency. Smokers are Productive, but Death Cuts Efficiency.
S M O K E R S A R E P R O D U C T I V E , B U T D E A T H C U T S E F F I C I E N C Y . S M O K E R S A R ....snip.... H C U T S E F F I C I E N C Y .
s m o k e r s a r e p r o d u c t i v e , b u t d e a t h c u t s... s m o k e r s a r ....snip.... b u t d e a t h c u t s...
s m o k e r s a r e p r o d u c t i v e , b u t . . . s m o k e r s a r e p r o d u c t i v e , b u t . . .
s m o k e r s a r e p. . . s m o k e r s a r e p. . .
]]> ]]>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.assign"> <sect1 id="language.function.assign">
<title>assign</title> <title>{assign}</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -37,20 +37,86 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
assign es usado para definir valores a las variables de template {assign} es usado para definir valores a las variables de template
durante la ejecuci<63>n del template. <emphasis role="bold">durante la ejecuci<63>n</emphasis> del template.
</para> </para>
<example> <example>
<title>assign</title> <title>{assign}</title>
<programlisting> <programlisting>
<![CDATA[
{assign var="name" value="Bob"} {assign var="name" value="Bob"}
The value of $name is {$name}. The value of $name is {$name}.
]]>
SALIDA: </programlisting>
<para>
The value of $name is Bob.</programlisting> Salida del ejemplo de arriba:
</para>
<screen>
<![CDATA[
The value of $name is Bob.
]]>
</screen>
</example> </example>
<example>
<title>Accesando variables desde un script de PHP. {assign}</title>
<para>
Puedes accesar {assign} variables desde php usando
<link linkend="api.get.template.vars">get_template_vars()</link>.
sin embargo, las variables solo estan disponibles despues/durante
la ejecuci<63>n del template como en el siguiente ejemplo
</para>
<programlisting>
<![CDATA[
{* index.tpl *}
{assign var="foo" value="Smarty"}
]]>
</programlisting>
<programlisting role="php">
<![CDATA[
<?php
// this will output nothing as the template has not been executed
echo $smarty->get_template_vars('foo');
// fetch the template to a dead variable
$dead = $smarty->fetch('index.tpl');
// this will output 'smarty' as the template has been executed
echo $smarty->get_template_vars('foo');
$smarty->assign('foo','Even smarter');
// this will output 'Even smarter'
echo $smarty->get_template_vars('foo');
?>
]]>
</programlisting>
</example>
<para>
La siguiente funci<63>n <emphasis>optionally</emphasis> tambi<62>n puede asignar variables al template.
</para>
<para>
<link linkend="language.function.capture">{capture}</link>,
<link linkend="language.function.include">{include}</link>,
<link linkend="language.function.include.php">{include_php}</link>,
<link linkend="language.function.insert">{insert}</link>,
<link linkend="language.function.counter">{counter}</link>,
<link linkend="language.function.cycle">{cycle}</link>,
<link linkend="language.function.eval">{eval}</link>,
<link linkend="language.function.fetch">{fetch}</link>,
<link linkend="language.function.math">{math}</link>,
<link linkend="language.function.textformat">{textformat}</link>
</para>
<para>
Ver tambi<62>n <link linkend="api.assign">assign()</link>
y <link linkend="api.get.template.vars">get_template_vars()</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.counter"> <sect1 id="language.function.counter">
<title>counter</title> <title>{counter}</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -65,7 +65,7 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
counter es usada para mostrar un conteo. counter va a depender del {counter} es usada para mostrar un conteo. {counter} va a depender del
conteo en cada iteraci<63>n. Usted puede ajustar el n<>mero, el intervalo conteo en cada iteraci<63>n. Usted puede ajustar el n<>mero, el intervalo
y la direcci<63>n del conteo, asi como determinar cuando mostrar o no el y la direcci<63>n del conteo, asi como determinar cuando mostrar o no el
conteo. Usted puede tener varios contadores al mismo tiempo, dando un conteo. Usted puede tener varios contadores al mismo tiempo, dando un

View File

@@ -63,16 +63,23 @@
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>La variable del template que recibir<69> la salida</entry> <entry>La variable del template que recibir<69> la salida</entry>
</row> </row>
<row>
<entry>reset</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry><emphasis>false</emphasis></entry>
<entry>Este coloca al ciclo en el primer valor y no le permite avanzar</entry>
</row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
Cycle es usado para hacer un ciclo a trav&eacute;s de un conjunto {Cycle} es usado para hacer un ciclo a trav<EFBFBD>s de un conjunto
de valores. Esto hace mas f<>cil alternar entre dos o mas colores de valores. Esto hace mas f<>cil alternar entre dos o mas colores
en una tabla, o ciclos a trav<61>z de una matriz de valores. en una tabla, o ciclos a trav<61>z de una matriz de valores.
</para> </para>
<para> <para>
Usted puede usar el cycle en mas de un conjunto de valores en su Usted puede usar el {cycle} en mas de un conjunto de valores en su
template supliendo el atributo name. De cada uno de los conjuntos template supliendo el atributo name. De cada uno de los conjuntos
de valores. de valores.
</para> </para>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.debug"> <sect1 id="language.function.debug">
<title>debug</title> <title>{debug}</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -23,7 +23,7 @@
<entry>output</entry> <entry>output</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>html</emphasis></entry> <entry><emphasis>javascript</emphasis></entry>
<entry>Tipo de salida, html o javascript</entry> <entry>Tipo de salida, html o javascript</entry>
</row> </row>
</tbody> </tbody>
@@ -38,6 +38,10 @@
decir en uso. Usted puede ver todas las variables disponibles decir en uso. Usted puede ver todas las variables disponibles
del template con scope. del template con scope.
</para> </para>
<para>
Ver tambi<62>n <link linkend="chapter.debugging.console">Debugging console</link>
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.eval"> <sect1 id="language.function.eval">
<title>eval</title> <title>{eval}</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -37,7 +37,7 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
eval es usado para evaluar una variable como de template. Esto puede {eval} es usado para evaluar una variable como de template. Esto puede
ser usado para cosas como incrustar tags(etiquetas)/variables del ser usado para cosas como incrustar tags(etiquetas)/variables del
template dentro de las variables o tags(etiquetas)/variables dentro template dentro de las variables o tags(etiquetas)/variables dentro
de las variables de un archivo de configuraci<63>n. de las variables de un archivo de configuraci<63>n.
@@ -60,26 +60,29 @@
<para> <para>
Las variables evaluadas son compiladas en cada invocaci<63>n, las Las variables evaluadas son compiladas en cada invocaci<63>n, las
vesiones compiladas no son salvas. Sin embargo, si usted tiene vesiones compiladas no son salvas. Sin embargo, si usted tiene
activado el cache, la salida se va a fijar en la cache junto con activado el cache, la salida se va a fijar en la
el resto del template. <link linkend="caching">cache</link> junto con el resto del template.
</para> </para>
</note> </note>
<example> <example>
<title>eval</title> <title>{eval}</title>
<programlisting> <programlisting>
<![CDATA[
setup.conf setup.conf
---------- ----------
emphstart = &lt;b&gt; emphstart = <strong>
emphend = &lt;/b&gt; emphend = </strong>
title = Welcome to {$company}'s home page! title = Welcome to {$company}'s home page!
ErrorCity = You must supply a {#emphstart#}city{#emphend#}. ErrorCity = You must supply a {#emphstart#}city{#emphend#}.
ErrorState = You must supply a {#emphstart#}state{#emphend#}. ErrorState = You must supply a {#emphstart#}state{#emphend#}.
]]>
</programlisting>
index.tpl <para>
--------- Where index.tpl is:
</para>
<programlisting>
<![CDATA[
{config_load file="setup.conf"} {config_load file="setup.conf"}
{eval var=$foo} {eval var=$foo}
@@ -87,15 +90,20 @@ index.tpl
{eval var=#ErrorCity#} {eval var=#ErrorCity#}
{eval var=#ErrorState# assign="state_error"} {eval var=#ErrorState# assign="state_error"}
{$state_error} {$state_error}
]]>
SALIDA:
This is the contents of foo.
Welcome to Foobar Pub &amp; Grill's home page!
You must supply a &lt;b&gt;city&lt;/b&gt;.
You must supply a &lt;b&gt;state&lt;/b&gt;.
</programlisting> </programlisting>
<para>
La salida del ejemplo de arriba:
</para>
<screen>
<![CDATA[
This is the contents of foo.
Welcome to Foobar Pub & Grill's home page!
You must supply a <strong>city</strong>.
You must supply a <strong>state</strong>.
]]>
</screen>
</example> </example>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.fetch"> <sect1 id="language.function.fetch">
<title>fetch</title> <title>{fetch}</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -37,7 +37,7 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
fetch es usado para obtener archivos de sistema local, http o ftp, y {fetch} es usado para obtener archivos de sistema local, http o ftp, y
mostrar el contenido. Si el nombre del archivo comienza con "http://", mostrar el contenido. Si el nombre del archivo comienza con "http://",
la p<>gina del web site sera traida y mostrada. Si el nombre del archivo la p<>gina del web site sera traida y mostrada. Si el nombre del archivo
comienza con "ftp://", el archivo ser<65> obtenido del servidor ftp y comienza con "ftp://", el archivo ser<65> obtenido del servidor ftp y
@@ -46,13 +46,13 @@
</para> </para>
<para> <para>
Si usted indica el atributo especial "assign", la salida de la funci<63>n Si usted indica el atributo especial "assign", la salida de la funci<63>n
fetch se ira a una variable de template en vez de ser mostrada en el {fetch} se ira a una variable de template en vez de ser mostrada en el
template. (nuevo en Smarty 1.5.0) template. (nuevo en Smarty 1.5.0)
</para> </para>
<note> <note>
<title>Nota T<>cnica</title> <title>Nota T<>cnica</title>
<para> <para>
Esto no soporta redirecionamento http, tenga la certeza de incluir Esto no soporta redirecionamento http, tenga la certeza de incluirlo
en la barra el seguimiento para ir a buscar donde sea necesario. en la barra el seguimiento para ir a buscar donde sea necesario.
</para> </para>
</note> </note>
@@ -62,23 +62,23 @@
Si tiene activada la seguridad en su template y usted estuviera Si tiene activada la seguridad en su template y usted estuviera
recibiendo un archivo del sistema de archivos local, esto permitira recibiendo un archivo del sistema de archivos local, esto permitira
que solo archivos de uno de los directorios estuviera definido como que solo archivos de uno de los directorios estuviera definido como
seguro. ($secure_dir) seguro. (<link linkend="variable.secure.dir">$secure_dir</link>)
</para> </para>
</note> </note>
<example> <example>
<title>fetch</title> <title>fetch</title>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{* Incluye algunos javascript en su template *} {* include some javascript in your template *}
{fetch file="/export/httpd/www.domain.com/docs/navbar.js"} {fetch file="/export/httpd/www.example.com/docs/navbar.js"}
{* Incrusta algun texto sobre el template desde otro sitio web *} {* embed some weather text in your template from another web site *}
{fetch file="http://www.myweather.com/68502/"} {fetch file="http://www.myweather.com/68502/"}
{* Obtiene un archivo de noticias via ftp *} {* fetch a news headline file via ftp *}
{fetch file="ftp://user:password@ftp.domain.com/path/to/currentheadlines.txt"} {fetch file="ftp://user:password@ftp.example.com/path/to/currentheadlines.txt"}
{* coloca el contenido en una variable de template *} {* assign the fetched contents to a template variable *}
{fetch file="http://www.myweather.com/68502/" assign="weather"} {fetch file="http://www.myweather.com/68502/" assign="weather"}
{if $weather ne ""} {if $weather ne ""}
<b>{$weather}</b> <b>{$weather}</b>
@@ -86,6 +86,11 @@
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n <link linkend="language.function.capture">{capture}</link>,
<link linkend="language.function.eval">{eval}</link>
y <link linkend="api.fetch">fetch()</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.html.checkboxes"> <sect1 id="language.function.html.checkboxes">
<title>html_checkboxes</title> <title>{html_checkboxes}</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -41,7 +41,7 @@
<entry>una matriz de salida para los botones checkbox</entry> <entry>una matriz de salida para los botones checkbox</entry>
</row> </row>
<row> <row>
<entry>selected/checked</entry> <entry>selected</entry>
<entry>string/array</entry> <entry>string/array</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>empty</emphasis></entry> <entry><emphasis>empty</emphasis></entry>
@@ -72,8 +72,9 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
html_checkboxes es una funci<EFBFBD>n personalizada que crea un grupo {html_checkboxes} es una
de checkbox con datos privistos. Este cuida cuales items(s) <link linkend="language.custom.functions">funci<EFBFBD>n personalizada</link>
que crea un grupo de checkbox con datos privistos. Este cuida cuales items(s)
estan selecionados por default. Los atributos requeridos son estan selecionados por default. Los atributos requeridos son
values y output, a menos que usted use options. values y output, a menos que usted use options.
Toda la salida es compatible con XHTML. Toda la salida es compatible con XHTML.
@@ -84,65 +85,99 @@
&lt;input&gt; creada. &lt;input&gt; creada.
</para> </para>
<example> <example>
<title>html_checkboxes</title> <title>{html_checkboxes}</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->assign('cust_ids', array(1000,1001,1002,1003)); $smarty->assign('cust_ids', array(1000,1001,1002,1003));
$smarty->assign('cust_names', array('Joe Schmoe','Jack Smith','Jane Johnson','Charlie Brown')); $smarty->assign('cust_names', array(
'Joe Schmoe',
'Jack Smith',
'Jane Johnson',
'Charlie Brown')
);
$smarty->assign('customer_id', 1001); $smarty->assign('customer_id', 1001);
$smarty->display('index.tpl');
?> ?>
]] ]]>
</programlisting> </programlisting>
<para> <para>
where index.tpl is: donde el template es
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{html_checkboxes name="id" values=$cust_ids selected=$customer_id output=$cust_names separator="<br />"} {html_checkboxes name="id" values=$cust_ids output=$cust_names
]] selected=$customer_id separator="<br />"}
]]>
</programlisting> </programlisting>
<para>
o donde el codigo es:
</para>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->assign('cust_checkboxes', array( $smarty->assign('cust_checkboxes', array(
1000 => 'Joe Schmoe', 1000 => 'Joe Schmoe',
1001 => 'Jack Smith', 1001 => 'Jack Smith',
1002 => 'Jane Johnson', 1002 => 'Jane Johnson',
1003 => 'Charlie Brown')); 1003 => 'Charlie Brown')
);
$smarty->assign('customer_id', 1001); $smarty->assign('customer_id', 1001);
$smarty->display('index.tpl');
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Donde index.tpl es: y el template es
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{html_checkboxes name="id" options=$cust_checkboxes selected=$customer_id separator="&lt;br /&gt;"} {html_checkboxes name="id" options=$cust_checkboxes selected=$customer_id separator="<br />"}
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Salida (los dos ejemplos): salida de ambos ejemplos:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
<label><input type="checkbox" name="id[]" value="1000" />Joe Schmoe</label><br /> <label><input type="checkbox" name="id[]" value="1000" />Joe Schmoe</label><br />
<label><input type="checkbox" name="id[]" value="1001" checked="checked" />Jack Smith</label><br /> <label><input type="checkbox" name="id[]" value="1001" checked="checked" />Jack Smith</label>
<br />
<label><input type="checkbox" name="id[]" value="1002" />Jane Johnson</label><br /> <label><input type="checkbox" name="id[]" value="1002" />Jane Johnson</label><br />
<label><input type="checkbox" name="id[]" value="1003" />Charlie Brown</label><br /> <label><input type="checkbox" name="id[]" value="1003" />Charlie Brown</label><br />
]]> ]]>
</screen> </screen>
</example> </example>
<example>
<title>
ejemplo de base de datos (eg PEAR o ADODB):
</title>
<programlisting role="php">
<![CDATA[
<?php
$sql = 'select type_id, types from types order by type';
$smarty->assign('types',$db->getAssoc($sql));
$sql = 'select * from contacts where contact_id=12';
$smarty->assign('contact',$db->getRow($sql));
?>
]]>
</programlisting>
<programlisting>
<![CDATA[
{html_checkboxes name="type" options=$types selected=$contact.type_id separator="<br />"}
]]>
</programlisting>
</example>
<para>
Vea tambi<62>n
<link linkend="language.function.html.radios">{html_radios}</link>
y <link linkend="language.function.html.options">{html_options}</link>
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -2,7 +2,7 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<!-- EN-Revision: 1.3 Maintainer: ramirez Status: ready --> <!-- EN-Revision: 1.3 Maintainer: ramirez Status: ready -->
<sect1 id="language.function.html.image"> <sect1 id="language.function.html.image">
<title>html_image</title> <title>{html_image}</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -66,17 +66,19 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
html_image es una funci<EFBFBD>n habitual que genera una etiqueta {html_image} es una
HTML para una imagen. La altura y lo largo son autom<6F>ticamente <link linkend="language.custom.functions">funci<EFBFBD>n habitual</link>
calculadas a partir del archivo de la imagen si ning<6E>n valor que genera una etiqueta HTML para una imagen. La altura y lo largo
suplido. son autom<6F>ticamente calculadas a partir del archivo de la imagen si
ning<6E>n valor suplido.
</para> </para>
<para> <para>
basedir es el directorio base en el cual las rutas relativas de las basedir es el directorio base en el cual las rutas relativas de las
imagenes estan basados. Si no lo proporciona, el document root del imagenes estan basados. Si no lo proporciona, el document root del
servidor (variable de ambiente DOCUMENT_ROOT) es usada como el servidor (<link linkend="language.variables.smarty">env</link> variable
directorio base. Si la seguridad esta habilitada, la ruta para la de ambiente DOCUMENT_ROOT) es usada como el
imagen debe estar dentro de un directorio seguro. directorio base. Si la <link linkend="variable.security">$security</link>
esta habilitada, la ruta para la imagen debe estar dentro de un directorio seguro.
</para> </para>
<para> <para>
<parameter>href</parameter> es el valor href a donde la imagen <parameter>href</parameter> es el valor href a donde la imagen
@@ -91,37 +93,26 @@
<note> <note>
<title>Nota T<>cnica</title> <title>Nota T<>cnica</title>
<para> <para>
html_image requiere un acceso a disco para leer la imagen y {html_image} requiere un acceso a disco para leer la imagen y
calcular la altura y el largo. Si usted no usa cache en el calcular la altura y el largo. Si usted no usa <link
template, generalmente es mejor evitar html_image y utilizar linkend="caching">cache</link> en el template,
las etiquetas de imagem est<73>ticas para un optimo funcionamiento. generalmente es mejor evitar {html_image} y utilizar
las etiquetas de imagen est<73>ticas para un optimo funcionamiento.
</para> </para>
</note> </note>
<example> <example>
<title>html_image example</title> <title>html_image example</title>
<programlisting role="php">
<![CDATA[
<?php
require('Smarty.class.php');
$smarty = new Smarty;
$smarty->display('index.tpl');
?>
]]>
</programlisting>
<para>
Donde index.tpl es:
</para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
where index.tpl is:
-------------------
{html_image file="pumpkin.jpg"} {html_image file="pumpkin.jpg"}
{html_image file="/path/from/docroot/pumpkin.jpg"} {html_image file="/path/from/docroot/pumpkin.jpg"}
{html_image file="../path/relative/to/currdir/pumpkin.jpg"} {html_image file="../path/relative/to/currdir/pumpkin.jpg"}
]]> ]]>
</programlisting> </programlisting>
<para> <para>
SALIDA (posible): la posible saldida puede ser:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.html.options"> <sect1 id="language.function.html.options">
<title>html_options</title> <title>{html_options}</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -58,15 +58,16 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
html_options es una funci<EFBFBD>n customizada que crea un grupo {html_options} es una
html option con los datos proporcionados. Este se encarga de <link linkend="language.custom.functions">funci<EFBFBD>n customizada</link>
cuidar cuales datos han sido selecionado por default. que crea un grupo html &lt;select&gt;&lt;option&gt; con los datos proporcionados.
Este se encarga de cuidar cuales datos han sido selecionado por default.
Los atributos son valores y salidas, a menos que usted utilice Los atributos son valores y salidas, a menos que usted utilice
options en lugar de eso. options en lugar de eso.
</para> </para>
<para> <para>
Si un valor es una matriz, este ser<65> tratado como un OPTGROUP html, Si un valor es una matriz, este ser<65> tratado como un &lt;optgroup&gt; html,
y mostrara los grupos. La recursi<73>n es soportada por OPTGROUP. y mostrara los grupos. La recursi<73>n es soportada por &lt;optgroup&gt;.
Todas las salidas son compatibles con XHTML. Todas las salidas son compatibles con XHTML.
</para> </para>
<para> <para>
@@ -76,58 +77,116 @@
De otra manera solo es generada la lista de opciones. De otra manera solo es generada la lista de opciones.
</para> </para>
<para> <para>
Todos los par&aacute;metros que no estan en la lista de arriba son Todos los par<EFBFBD>metros que no estan en la lista de arriba son
exibidos como name/value-pairs dentro de las etiquetas &lt;select&gt;. exibidos como name/value-pairs dentro de las etiquetas &lt;select&gt;.
Estas son ignoradas si la opcion <emphasis>name</emphasis> no es dada. Estas son ignoradas si la opcion <emphasis>name</emphasis> no es dada.
</para> </para>
<example> <example>
<title>html_options</title> <title>{html_options}</title>
<para>
<emphasis role="bold">Ejemplo 1:</emphasis>
</para>
<programlisting role="php">
<![CDATA[
<?php
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
$smarty->assign('cust_names', array(
'Joe Schmoe',
'Jack Smith',
'Jane Johnson',
'Charlie Brown'));
$smarty->assign('customer_id', 1001);
?>
]]>
</programlisting>
<para>
donde el template es:
</para>
<programlisting> <programlisting>
index.php: <![CDATA[
<select name=customer_id>
{html_options values=$cust_ids output=$cust_names selected=$customer_id}
</select>
]]>
</programlisting>
<para>
<emphasis role="bold">Ejemplo 2:</emphasis>
</para>
<programlisting role="php">
<![CDATA[
<?php
require('Smarty.class.php'); $smarty->assign('cust_options', array(
$smarty = new Smarty; 1000 => 'Joe Schmoe',
$smarty-&gt;assign('cust_ids', array(1000,1001,1002,1003)); 1001 => 'Jack Smith',
$smarty-&gt;assign('cust_names', array('Joe Schmoe','Jack Smith','Jane 1002 => 'Jane Johnson',
Johnson','Carlie Brown')); 1003 => 'Charlie Brown')
$smarty-&gt;assign('customer_id', 1001); );
$smarty-&gt;display('index.tpl'); $smarty->assign('customer_id', 1001);
index.tpl: ?>
]]>
&lt;select name=customer_id&gt; </programlisting>
{html_options values=$cust_ids selected=$customer_id output=$cust_names} <para>
&lt;/select&gt; donde el template es:
</para>
<programlisting>
index.php: <![CDATA[
<select name=customer_id>
require('Smarty.class.php');
$smarty = new Smarty;
$smarty-&gt;assign('cust_options', array(
1001 =&gt; 'Joe Schmoe',
1002 =&gt; 'Jack Smith',
1003 =&gt; 'Jane Johnson',
1004 =&gt; 'Charlie Brown'));
$smarty-&gt;assign('customer_id', 1001);
$smarty-&gt;display('index.tpl');
index.tpl:
&lt;select name=customer_id&gt;
{html_options options=$cust_options selected=$customer_id} {html_options options=$cust_options selected=$customer_id}
&lt;/select&gt; </select>
]]>
</programlisting>
<para>
Salida de ambos ejemplos de arriba:
</para>
<screen>
<![CDATA[
<select name=customer_id>
<option label="Joe Schmoe" value="1000">Joe Schmoe</option>
<option label="Jack Smith" value="1001" selected="selected">Jack Smith</option>
<option label="Jane Johnson" value="1002">Jane Johnson</option>
<option label="Charlie Brown" value="1003">Charlie Brown</option>
</select>
]]>
SALIDA: (Ambos ejemplos) </screen>
&lt;select name=customer_id&gt;
&lt;option value="1000"&gt;Joe Schmoe&lt;/option&gt;
&lt;option value="1001" selected="selected"&gt;Jack Smith&lt;/option&gt;
&lt;option value="1002"&gt;Jane Johnson&lt;/option&gt;
&lt;option value="1003"&gt;Charlie Brown&lt;/option&gt;
&lt;/select&gt;</programlisting>
</example> </example>
<example>
<title>{html_options} - Ejemplo con base de datos (eg PEAR o ADODB):</title>
<programlisting role="php">
<![CDATA[
<?php
$sql = 'select type_id, types from types order by type';
$smarty->assign('types',$db->getAssoc($sql));
$sql = 'select contact_id, name, email, type_id
from contacts where contact_id='.$contact_id;
$smarty->assign('contact',$db->getRow($sql));
?>
]]>
</programlisting>
<para>
Donde el template es:
</para>
<programlisting>
<![CDATA[
<select name="type_id">
<option value='null'>-- none --</option>
{html_options name="type" options=$types selected=$contact.type_id}
</select>
]]>
</programlisting>
</example>
<para>
vea tambi<62>n
<link linkend="language.function.html.checkboxes">{html_checkboxes}</link>
y <link linkend="language.function.html.radios">{html_radios}</link>
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.html.radios"> <sect1 id="language.function.html.radios">
<title>html_radios</title> <title>{html_radios}</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -65,9 +65,10 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
html_radios es una funci&oacute;n customizada que crea grupos de {html_radios} es una
botones de radio html con los datos proporcionados. Este esta <link linkend="language.custom.functions">funci<EFBFBD>n customizada</link>
atento para saber cual objeto esta selccionado por default. que crea grupos de botones de radio html con los datos proporcionados.
Este esta atento para saber cual objeto esta selccionado por default.
Los atributos requeridos son valores y salidas, a menos que usted Los atributos requeridos son valores y salidas, a menos que usted
use option en lugar de eso. Toda salida es compatible con XHTML. use option en lugar de eso. Toda salida es compatible con XHTML.
</para> </para>
@@ -77,49 +78,105 @@
</para> </para>
<example> <example>
<title>html_radios</title> <title>{html_radios} : Ejemplo 1</title>
<programlisting role="php">
<![CDATA[
<?php
$smarty->assign('cust_ids', array(1000,1001,1002,1003));
$smarty->assign('cust_names', array(
'Joe Schmoe',
'Jack Smith',
'Jane Johnson',
'Charlie Brown')
);
$smarty->assign('customer_id', 1001);
?>
]]>
</programlisting>
<para>
Donde el template es:
</para>
<programlisting> <programlisting>
index.php: <![CDATA[
{html_radios name="id" values=$cust_ids output=$cust_names
require('Smarty.class.php'); selected=$customer_id separator="<br />"}
$smarty = new Smarty; ]]>
$smarty-&gt;assign('cust_ids', array(1000,1001,1002,1003)); </programlisting>
$smarty-&gt;assign('cust_names', array('Joe Schmoe','Jack Smith','Jane
Johnson','Charlie Brown'));
$smarty-&gt;assign('customer_id', 1001);
$smarty-&gt;display('index.tpl');
index.tpl:
{html_radios name="id" values=$cust_ids selected=$customer_id output=$cust_names separator="&lt;br /&gt;"}
index.php:
require('Smarty.class.php');
$smarty = new Smarty;
$smarty-&gt;assign('cust_radios', array(
1000 =&gt; 'Joe Schmoe',
1001 =&gt; 'Jack Smith',
1002 =&gt; 'Jane Johnson',
1003 =&gt; 'Charlie Brown'));
$smarty-&gt;assign('customer_id', 1001);
$smarty-&gt;display('index.tpl');
index.tpl:
{html_radios name="id" options=$cust_radios selected=$customer_id separator="&lt;br /&gt;"}
SALIDA: (Ambos ejemplos)
&lt;input type="radio" name="id" value="1000"&gt;Joe Schmoe&lt;br /&gt;
&lt;input type="radio" name="id" value="1001" checked="checked"&gt;Jack Smith&lt;br /&gt;
&lt;input type="radio" name="id" value="1002"&gt;Jane Johnson&lt;br /&gt;
&lt;input type="radio" name="id" value="1003"&gt;Charlie Brown&lt;br /&gt;</programlisting>
</example> </example>
<example>
<title>{html_radios} : Ejemplo 2</title>
<programlisting role="php">
<![CDATA[
<?php
$smarty->assign('cust_radios', array(
1000 => 'Joe Schmoe',
1001 => 'Jack Smith',
1002 => 'Jane Johnson',
1003 => 'Charlie Brown'));
$smarty->assign('customer_id', 1001);
?>
]]>
</programlisting>
<para>
Donde index.tpl es:
</para>
<programlisting>
<![CDATA[
{html_radios name="id" options=$cust_radios selected=$customer_id separator="<br />"}
]]>
</programlisting>
<para>
Salida de ambos ejemplos:
</para>
<screen>
<![CDATA[
<label for="id_1000">
<input type="radio" name="id" value="1000" id="id_1000" />Joe
Schmoe</label><br />
<label for="id_1001"><input type="radio" name="id" value="1001" id="id_1001"
checked="checked" />Jack
Smith</label><br />
<label for="id_1002"><input type="radio" name="id" value="1002" id="id_1002" />Jane
Johnson</label><br />
<label for="id_1003"><input type="radio" name="id" value="1003" id="id_1003" />Charlie
Brown</label><br />
]]>
</screen>
</example>
<example>
<title>{html_radios}- Ejemplo con base de Datos (eg PEAR o ADODB):</title>
<programlisting role="php">
<![CDATA[
<?php
$sql = 'select type_id, types from types order by type';
$smarty->assign('types',$db->getAssoc($sql));
$sql = 'select contact_id, name, email, type_id
from contacts where contact_id='.$contact_id;
$smarty->assign('contact',$db->getRow($sql));
?>
]]>
</programlisting>
<para>
y el template:
</para>
<programlisting>
<![CDATA[
{html_radios name="type" options=$types selected=$contact.type_id separator="<br />"}
]]>
</programlisting>
</example>
<para>
ver tambi<62>n
<link linkend="language.function.html.checkboxes">{html_checkboxes}</link>
y <link linkend="language.function.html.options">{html_options}</link>
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.html.select.date"> <sect1 id="language.function.html.select.date">
<title>html_select_date</title> <title>{html_select_date}</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -86,8 +86,7 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>%02d</entry> <entry>%02d</entry>
<entry>Cual debe ser el formato de salida del dia <entry>Cual debe ser el formato de salida del dia dentro de (sprintf)</entry>
dentro de (sprintf)</entry>
</row> </row>
<row> <row>
<entry>day_value_format</entry> <entry>day_value_format</entry>
@@ -245,105 +244,102 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
html_select_date es una funci<EFBFBD>n customizada que crea menus dropdowns {html_select_date} es una
de fechas para usted. Este puede mostrar algunos o todos por a<>o, <link linkend="language.custom.functions">funci<EFBFBD>n customizada</link>
mes y dia. que crea menus dropdowns de fechas para usted. Este puede mostrar
algunos o todos por a<>o, mes y dia.
</para> </para>
<example> <example>
<title>html_select_date</title> <title>{html_select_date}</title>
<para>Codigo del Template</para>
<programlisting> <programlisting>
<![CDATA[
{html_select_date} {html_select_date}
]]>
</programlisting>
SALIDA: <para>
Esta es la salida:
&lt;select name="Date_Month"&gt; </para>
&lt;option value="1"&gt;January&lt;/option&gt; <screen>
&lt;option value="2"&gt;February&lt;/option&gt; <![CDATA[
&lt;option value="3"&gt;March&lt;/option&gt; <select name="Date_Month">
&lt;option value="4"&gt;April&lt;/option&gt; <option value="1">January</option>
&lt;option value="5"&gt;May&lt;/option&gt; <option value="2">February</option>
&lt;option value="6"&gt;June&lt;/option&gt; <option value="3">March</option>
&lt;option value="7"&gt;July&lt;/option&gt; ..... snipped .....
&lt;option value="8"&gt;August&lt;/option&gt; <option value="10">October</option>
&lt;option value="9"&gt;September&lt;/option&gt; <option value="11">November</option>
&lt;option value="10"&gt;October&lt;/option&gt; <option value="12" selected="selected">December</option>
&lt;option value="11"&gt;November&lt;/option&gt; </select>
&lt;option value="12" selected&gt;December&lt;/option&gt; <select name="Date_Day">
&lt;/select&gt; <option value="1">01</option>
&lt;select name="Date_Day"&gt; <option value="2">02</option>
&lt;option value="1"&gt;01&lt;/option&gt; <option value="3">03</option>
&lt;option value="2"&gt;02&lt;/option&gt; ..... snipped .....
&lt;option value="3"&gt;03&lt;/option&gt; <option value="11">11</option>
&lt;option value="4"&gt;04&lt;/option&gt; <option value="12">12</option>
&lt;option value="5"&gt;05&lt;/option&gt; <option value="13" selected="selected">13</option>
&lt;option value="6"&gt;06&lt;/option&gt; <option value="14">14</option>
&lt;option value="7"&gt;07&lt;/option&gt; <option value="15">15</option>
&lt;option value="8"&gt;08&lt;/option&gt; ..... snipped .....
&lt;option value="9"&gt;09&lt;/option&gt; <option value="29">29</option>
&lt;option value="10"&gt;10&lt;/option&gt; <option value="30">30</option>
&lt;option value="11"&gt;11&lt;/option&gt; <option value="31">31</option>
&lt;option value="12"&gt;12&lt;/option&gt; </select>
&lt;option value="13" selected&gt;13&lt;/option&gt; <select name="Date_Year">
&lt;option value="14"&gt;14&lt;/option&gt; <option value="2001" selected="selected">2001</option>
&lt;option value="15"&gt;15&lt;/option&gt; </select>
&lt;option value="16"&gt;16&lt;/option&gt; ]]>
&lt;option value="17"&gt;17&lt;/option&gt; </screen>
&lt;option value="18"&gt;18&lt;/option&gt;
&lt;option value="19"&gt;19&lt;/option&gt;
&lt;option value="20"&gt;20&lt;/option&gt;
&lt;option value="21"&gt;21&lt;/option&gt;
&lt;option value="22"&gt;22&lt;/option&gt;
&lt;option value="23"&gt;23&lt;/option&gt;
&lt;option value="24"&gt;24&lt;/option&gt;
&lt;option value="25"&gt;25&lt;/option&gt;
&lt;option value="26"&gt;26&lt;/option&gt;
&lt;option value="27"&gt;27&lt;/option&gt;
&lt;option value="28"&gt;28&lt;/option&gt;
&lt;option value="29"&gt;29&lt;/option&gt;
&lt;option value="30"&gt;30&lt;/option&gt;
&lt;option value="31"&gt;31&lt;/option&gt;
&lt;/select&gt;
&lt;select name="Date_Year"&gt;
&lt;option value="2001" selected&gt;2001&lt;/option&gt;
&lt;/select&gt;</programlisting>
</example> </example>
<example> <example>
<title>html_select_date</title> <title>{html_select_date}</title>
<programlisting> <programlisting>
<![CDATA[
{* el a<>o de comienzo y fin puede ser relativo al a<>o actual *} {* el a<>o seleccionado puede ser relativo al a<>o actual *}
{html_select_date prefix="StartDate" time=$time start_year="-5" end_year="+1" display_days=false} {html_select_date prefix="StartDate" time=$time start_year="-5"
end_year="+1" display_days=false}
SALIDA: (El a<>o actual es 2000) ]]>
</programlisting>
&lt;select name="StartDateMonth"&gt; <para>
&lt;option value="1"&gt;January&lt;/option&gt; esta es la salida: (el a<>o actual es 2000)
&lt;option value="2"&gt;February&lt;/option&gt; </para>
&lt;option value="3"&gt;March&lt;/option&gt; <screen>
&lt;option value="4"&gt;April&lt;/option&gt; <![CDATA[
&lt;option value="5"&gt;May&lt;/option&gt; <select name="StartDateMonth">
&lt;option value="6"&gt;June&lt;/option&gt; <option value="1">January</option>
&lt;option value="7"&gt;July&lt;/option&gt; <option value="2">February</option>
&lt;option value="8"&gt;August&lt;/option&gt; <option value="3">March</option>
&lt;option value="9"&gt;September&lt;/option&gt; <option value="4">April</option>
&lt;option value="10"&gt;October&lt;/option&gt; <option value="5">May</option>
&lt;option value="11"&gt;November&lt;/option&gt; <option value="6">June</option>
&lt;option value="12" selected&gt;December&lt;/option&gt; <option value="7">July</option>
&lt;/select&gt; <option value="8">August</option>
&lt;select name="StartDateYear"&gt; <option value="9">September</option>
&lt;option value="1999"&gt;1995&lt;/option&gt; <option value="10">October</option>
&lt;option value="1999"&gt;1996&lt;/option&gt; <option value="11">November</option>
&lt;option value="1999"&gt;1997&lt;/option&gt; <option value="12" selected="selected">December</option>
&lt;option value="1999"&gt;1998&lt;/option&gt; </select>
&lt;option value="1999"&gt;1999&lt;/option&gt; <select name="StartDateYear">
&lt;option value="2000" selected&gt;2000&lt;/option&gt; <option value="1995">1995</option>
&lt;option value="2001"&gt;2001&lt;/option&gt; <option value="1996">1996</option>
&lt;/select&gt;</programlisting> <option value="1997">1997</option>
<option value="1998">1998</option>
<option value="1999">1999</option>
<option value="2000" selected="selected">2000</option>
<option value="2001">2001</option>
</select>
]]>
</screen>
</example> </example>
<para>
Ver tambi<62>n <link linkend="language.function.html.select.time">{html_select_time}</link>,
<link linkend="language.modifier.date.format">date_format</link>,
<link linkend="language.variables.smarty.now">$smarty.now</link>
y <link linkend="tips.dates">date tips</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
mode: sgml mode: sgml

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.html.select.time"> <sect1 id="language.function.html.select.time">
<title>html_select_time</title> <title>{html_select_time}</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -133,31 +133,27 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
html_select_time es una funci<EFBFBD>n customizada {html_select_time} es una
que crea menus dropdowns de tiempo para usted. <link linkend="language.custom.functions">funci<EFBFBD>n customizada</link>
Esta puede mostrar algunos valores, o que crea menus dropdowns de tiempo para usted. Esta puede mostrar
todo en hora, minuto, segundo y am/pm. algunos valores, o todo en hora, minuto, segundo y am/pm.
</para> </para>
<para> <para>
Los atributos de time pueden tener diferentes Los atributos de time pueden tener diferentes formatos. Este puede ser
formatos. el puede ser un unico timestamp o un unico timestamp o una cadena conteniendo YYYYMMDDHHMMSS o una cadena
una cadena conteniendo Y-M-D. YYYY-MM-DD puede parseda por php's <ulink url="&url.php-manual;strtotime">strtotime()</ulink>.
ser lo mas com<6F>n. exepto meses y dias con menos
de dos digitos tambi<62>n son reconocidos;
Si uno de los 3 valores (Y,M,D) es una cadena
vacia, que segun el select-box no es pre-seleccionada
del todo. este es especialmente usado con los
atributos empty_teay-, -month- y -day-.
</para> </para>
<example> <example>
<title>html_select_time</title> <title>{html_select_time}</title>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
template code:
--------------
{html_select_time use_24_hours=true} {html_select_time use_24_hours=true}
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Esta es la salidat: Esta es la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -318,6 +314,12 @@
]]> ]]>
</screen> </screen>
</example> </example>
<para>
Ver tambi<62>n
<link linkend="language.variables.smarty.now">$smarty.now</link>,
<link linkend="language.function.html.select.date">{html_select_date}</link>
y <link linkend="tips.dates">date tips</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.html.table"> <sect1 id="language.function.html.table">
<title>html_table</title> <title>{html_table}</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -31,13 +31,12 @@
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>3</emphasis></entry> <entry><emphasis>3</emphasis></entry>
<entry>N<EFBFBD>mero de columnas para la tabla. Si el <entry>N<EFBFBD>mero de columnas para la tabla. Si el atributo cols esta vacio,
atributo cols esta vacio, los renglones seran determinados, los renglones seran determinados, entonces el numero de columnas
entonces el numero de columnas sera calculado por el sera calculado por el numero de renglones y el numero de elementos a
numero de renglones y el numero de elementos a mostrar mostrar para ser ajustado a las columnas de todos los elementos que seran
para ser ajustado a las columnas de todos los mostrados, si ambos, renglones y columnas, son omitidos las columnas por
elementos que seran mostrados, si ambos, renglones y default son 3.
columnas, son omitidos las columnas por default son 3.
</entry> </entry>
</row> </row>
<row> <row>
@@ -45,12 +44,10 @@
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>empty</emphasis></entry> <entry><emphasis>empty</emphasis></entry>
<entry> N<>mero de renglones en la tabla. Si el atributo <entry> N<>mero de renglones en la tabla. Si el atributo rows es vacio,
rows es vacio, las columnas seran determinadas, las columnas seran determinadas, entonces el numero de renglones sera
entonces el numero de renglones sera calculado por el calculado por el numero de columnas y el numero de elementos a mostrar
numero de columnas y el numero de elementos a mostrar para ser ajustado el numero de renglones al total de elementos a ser mostrados.
para ser ajustado el numero de renglones al total de
elementos a ser mostrados.
</entry> </entry>
</row> </row>
<row> <row>
@@ -58,12 +55,10 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>cols</emphasis></entry> <entry><emphasis>cols</emphasis></entry>
<entry> Direcci<63>n consecutiva de los elementos en el <entry> Direcci<63>n consecutiva de los elementos en el arreglo para ser representados.
arreglo para ser representados. <emphasis>cols</emphasis> manera en que los elementos son mostrados columna
<emphasis>cols</emphasis> manera en que los por columna. <emphasis>rows</emphasis> manera en que los elementos son mostrados
elementos son mostrados columna por columna. renglon por renglon.
<emphasis>rows</emphasis> manera en que los
elementos son mostrados renglon por renglon.
</entry> </entry>
</row> </row>
<row> <row>
@@ -101,10 +96,8 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>right</emphasis></entry> <entry><emphasis>right</emphasis></entry>
<entry> direcci<63>n de una linea para ser representada. <entry> direcci<63>n de una linea para ser representada. posibles valores:
posibles valores: <emphasis>left</emphasis> (left-to-right), <emphasis>right</emphasis> (right-to-left)
<emphasis>left</emphasis> (left-to-right),
<emphasis>right</emphasis> (right-to-left)
</entry> </entry>
</row> </row>
<row> <row>
@@ -112,49 +105,55 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>down</emphasis></entry> <entry><emphasis>down</emphasis></entry>
<entry>Direcci<EFBFBD>n de las columnas para ser representadas. <entry>Direcci<EFBFBD>n de las columnas para ser representadas. posibles valores:
posibles valores: <emphasis>down</emphasis> (top-to-bottom), <emphasis>up</emphasis> (bottom-to-top)
<emphasis>down</emphasis> (top-to-bottom),
<emphasis>up</emphasis> (bottom-to-top)
</entry> </entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
<emphasis>html_table</emphasis> Es una funci<63>n customizada que {html_table} Es una
transforma un arreglo de datos en una tabla HTML. <link linkend="language.custom.functions">funci<EFBFBD>n customizada</link>
El atributo <emphasis>cols</emphasis> determina el n<>mero de que transforma un arreglo de datos en una tabla HTML. El atributo
columnas que tendra la tabla. <emphasis>cols</emphasis> determina el n<>mero de columnas que tendra la tabla.
Los valores <emphasis>table_attr</emphasis>, Los valores <emphasis>table_attr</emphasis>, <emphasis>tr_attr</emphasis> y
<emphasis>tr_attr</emphasis> y <emphasis>td_attr</emphasis> <emphasis>td_attr</emphasis> determinan los atributos dados para las etiquetas
determinan los atributos dados para las etiquetas tabla, tr y td. tabla, tr y td. Si <emphasis>tr_attr</emphasis> o <emphasis>td_attr</emphasis>
Si <emphasis>tr_attr</emphasis> o <emphasis>td_attr</emphasis> son arreglos, ellos entraran en un ciclo. <emphasis>trailpad</emphasis> y el
son arreglos, ellos entraran en un ciclo. valor depositado dentro de trailing cells en la ultima linea de la tabla si existe
<emphasis>trailpad</emphasis> y el valor depositado dentro de alguna presente.
trailing cells en la ultima linea de la tabla si existe alguna
presente.
</para> </para>
<example> <example>
<title>html_table</title> <title>html_table</title>
<programlisting> <programlisting role="php">
<![CDATA[ <![CDATA[
index.php: php code:
---------
<?php
require('Smarty.class.php'); require('Smarty.class.php');
$smarty = new Smarty; $smarty = new Smarty;
$smarty->assign('data',array(1,2,3,4,5,6,7,8,9)); $smarty->assign('data',array(1,2,3,4,5,6,7,8,9));
$smarty->assign('tr',array('bgcolor="#eeeeee"','bgcolor="#dddddd"')); $smarty->assign('tr',array('bgcolor="#eeeeee"','bgcolor="#dddddd"'));
$smarty->display('index.tpl'); $smarty->display('index.tpl');
?>
index.tpl: ]]>
</programlisting>
<programlisting>
<![CDATA[
template code:
--------------
{html_table loop=$data} {html_table loop=$data}
{html_table loop=$data cols=4 table_attr='border="0"'} {html_table loop=$data cols=4 table_attr='border="0"'}
{html_table loop=$data cols=4 tr_attr=$tr} {html_table loop=$data cols=4 tr_attr=$tr}
]]>
SALIDA: </programlisting>
<para>
La salida de ambos ejemplos:
</para>
<screen>
<![CDATA[
<table border="1"> <table border="1">
<tr><td>1</td><td>2</td><td>3</td></tr> <tr><td>1</td><td>2</td><td>3</td></tr>
<tr><td>4</td><td>5</td><td>6</td></tr> <tr><td>4</td><td>5</td><td>6</td></tr>
@@ -170,9 +169,11 @@ SALIDA:
<tr bgcolor="#dddddd"><td>5</td><td>6</td><td>7</td><td>8</td></tr> <tr bgcolor="#dddddd"><td>5</td><td>6</td><td>7</td><td>8</td></tr>
<tr bgcolor="#eeeeee"><td>9</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr> <tr bgcolor="#eeeeee"><td>9</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
</table> </table>
]]></programlisting> ]]>
</screen>
</example> </example>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
mode: sgml mode: sgml

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.mailto"> <sect1 id="language.function.mailto">
<title>mailto</title> <title>{mailto}</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -31,15 +31,16 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>El texto para mostrar, el default es la <entry>El texto para mostrar, el default es la direcci<63>n de correo (e-mail)</entry>
direcci<63>n de correo (e-mail)</entry>
</row> </row>
<row> <row>
<entry>encode</entry> <entry>encode</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>none</emphasis></entry> <entry><emphasis>none</emphasis></entry>
<entry>Como codificar el e-mail. Puede ser none, hex o javascript. <entry>Como codificar el e-mail. Puede ser
<literal>none</literal>, <literal>hex</literal>,
<literal>javascript</literal> o <literal>javascript_charcode</literal>.
</entry> </entry>
</row> </row>
<row> <row>
@@ -96,7 +97,7 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
mailto automatiza el proceso de creaci<63>n de links de correo {mailto} automatiza el proceso de creaci<63>n de links de correo
electronico(e-mail) y opcionalmente los codifica. electronico(e-mail) y opcionalmente los codifica.
Codificar el correo electronico(e-mail) hace mas dif<69>cil que Codificar el correo electronico(e-mail) hace mas dif<69>cil que
las web spiders tomen las direciones de nuestro sitio. las web spiders tomen las direciones de nuestro sitio.
@@ -109,30 +110,49 @@
</para> </para>
</note> </note>
<example> <example>
<title>mailto</title> <title>{mailto}</title>
<programlisting> <programlisting>
{mailto address="me@domain.com"} <![CDATA[
{mailto address="me@domain.com" text="send me some mail"} {mailto address="me@example.com"}
{mailto address="me@domain.com" encode="javascript"} <a href="mailto:me@example.com" >me@example.com</a>
{mailto address="me@domain.com" encode="hex"}
{mailto address="me@domain.com" subject="Hello to you!"}
{mailto address="me@domain.com" cc="you@domain.com,they@domain.com"}
{mailto address="me@domain.com" extra='class="email"'}
SALIDA: {mailto address="me@example.com" text="send me some mail"}
<a href="mailto:me@example.com" >send me some mail</a>
&lt;a href="mailto:me@domain.com" &gt;me@domain.com&lt;/a&gt; {mailto address="me@example.com" encode="javascript"}
&lt;a href="mailto:me@domain.com" &gt;send me some mail&lt;/a&gt; <script type="text/javascript" language="javascript">
&lt;script type="text/javascript" language="javascript"&gt;eval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%6 eval(unescape('%64%6f% ... snipped ...%61%3e%27%29%3b'))
9%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d% </script>
61%69%6e%2e%63%6f%6d%22%20%3e%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%3c%2f%61%3e
%27%29%3b'))&lt;/script&gt; {mailto address="me@example.com" encode="hex"}
&lt;a href="mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d" &gt;&#x6d;&#x65;&#x40;&#x64;&#x6f;&#x6d;&#x61;&#x69;&#x6e;&#x2e;&#x63;&#x6f;&#x6d;&lt;/a&gt; <a href="mailto:%6d%65.. snipped..3%6f%6d">&#x6d;&..snipped...#x6f;&#x6d;</a>
&lt;a href="mailto:me@domain.com?subject=Hello%20to%20you%21" &gt;me@domain.com&lt;/a&gt;
&lt;a href="mailto:me@domain.com?cc=you@domain.com%2Cthey@domain.com" &gt;me@domain.com&lt;/a&gt; {mailto address="me@example.com" subject="Hello to you!"}
&lt;a href="mailto:me@domain.com" class="email"&gt;me@domain.com&lt;/a&gt;</programlisting> <a href="mailto:me@example.com?subject=Hello%20to%20you%21" >me@example.com</a>
{mailto address="me@example.com" cc="you@example.com,they@example.com"}
<a href="mailto:me@example.com?cc=you@example.com%2Cthey@example.com" >me@example.com</a>
{mailto address="me@example.com" extra='class="email"'}
<a href="mailto:me@example.com" class="email">me@example.com</a>
{mailto address="me@example.com" encode="javascript_charcode"}
<script type="text/javascript" language="javascript">
<!--
{document.write(String.fromCharCode(60,97, ... snipped ....60,47,97,62))}
//-->
</script>
]]>
</programlisting>
</example> </example>
<para>
ver tambi<62>n
<link linkend="language.modifier.escape">escape</link>,
<link linkend="tips.obfuscating.email">Obfuscating E-mail Addresses</link>
y <link linkend="language.function.textformat">{textformat}</link>
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
mode: sgml mode: sgml

View File

@@ -58,7 +58,7 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
math permite dise<73>ar ecuaciones matem<65>ticas dentro del template. {math} permite dise<73>ar ecuaciones matem<65>ticas dentro del template.
Cualquier variable num<75>rica del template puede ser usada en Cualquier variable num<75>rica del template puede ser usada en
ecuaciones, y el resultado es mostrado en lugar de la etiqueta. ecuaciones, y el resultado es mostrado en lugar de la etiqueta.
Las variables usadas en ecuaciones son pasadas como par<61>metros, Las variables usadas en ecuaciones son pasadas como par<61>metros,
@@ -76,55 +76,92 @@
<note> <note>
<title>Nota T<>cnica</title> <title>Nota T<>cnica</title>
<para> <para>
math es una funci<63>n de muy alto rendimiento debido a que se {math} es una funci<63>n de muy alto rendimiento debido a que se puede
puede usar con la funci<63>n eval() de PHP. usar con la funci<63>n <ulink url="&url.php-manual;eval">eval()</ulink>
Hacer las matem<65>ticas en PHP es mucho mas eficiente, asi en de PHP. Hacer las matem<65>ticas en PHP es mucho mas eficiente, asi en
cualquier momento es posible hacer calculos matem<65>ticos en PHP cualquier momento es posible hacer calculos matem<65>ticos en PHP asignarlos
asignarlos a una variable y lanzar los resultados al template. a una variable y lanzar los resultados al template. Def<65>nitivamente evite
Def<EFBFBD>nitivamente evite llamadas repetitivas de funciones llamadas repetitivas de funciones matem<EFBFBD>ticas, dentro de los ciclos
matem<EFBFBD>ticas, dentro de los ciclos section. <link linkend="language.function.section">{section}</link>.
</para> </para>
</note> </note>
<example> <example>
<title>math</title> <title>{math}</title>
<para>
<emphasis role="bold">Ejemplo a:</emphasis>
</para>
<programlisting> <programlisting>
<![CDATA[
{* $height=4, $width=5 *} {* $height=4, $width=5 *}
{math equation="x + y" x=$height y=$width} {math equation="x + y" x=$height y=$width}
]]>
SALIDA: </programlisting>
<para>
Salida del ejemplo de arriba:
</para>
<screen>
<![CDATA[
9 9
]]>
</screen>
<para>
<emphasis role="bold">Ejemplo b:</emphasis>
</para>
<programlisting>
<![CDATA[
{* $row_height = 10, $row_width = 20, #col_div# = 2, assigned in template *} {* $row_height = 10, $row_width = 20, #col_div# = 2, assigned in template *}
{math equation="height * width / division" {math equation="height * width / division"
height=$row_height height=$row_height
width=$row_width width=$row_width
division=#col_div#} division=#col_div#}
]]>
SALIDA: </programlisting>
<para>
Salida del ejemplo de arriba:
</para>
<screen>
<![CDATA[
100 100
]]>
</screen>
{* Usted puede usar parentesis *} <para>
<emphasis role="bold">Ejemplo c:</emphasis>
</para>
<programlisting>
<![CDATA[
{* you can use parenthesis *}
{math equation="(( x + y ) / z )" x=2 y=10 z=2} {math equation="(( x + y ) / z )" x=2 y=10 z=2}
]]>
SALIDA: </programlisting>
<para>
Salida del ejemplo de arriba:
</para>
<screen>
<![CDATA[
6 6
]]>
</screen>
{* Usted puede asignar un par<61>metro de formato en sprintf *} <para>
<emphasis role="bold">Ejemplo d:</emphasis>
</para>
<programlisting>
<![CDATA[
{* you can supply a format parameter in sprintf format *}
{math equation="x + y" x=4.4444 y=5.0000 format="%.2f"} {math equation="x + y" x=4.4444 y=5.0000 format="%.2f"}
]]>
SALIDA: </programlisting>
<para>
9.44</programlisting> Salida del ejemplo de arriba:
</para>
<screen>
<![CDATA[
9.44
]]>
</screen>
</example> </example>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -1,28 +1,31 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.popup.init"> <sect1 id="language.function.popup.init">
<title>popup_init</title> <title>{popup_init}</title>
<para> <para>
popup es una integraci<63>n de overLib, una biblioteca usada para <link linkend="language.function.popup">{popup}</link> es una integraci<63>n
ventanas popup. Esta es usada como contexto de infomaci<63>n sensitiva, de <ulink url="&url.overLib;">overLib</ulink>, una biblioteca usada para
como ventanas de ayuda o herramientas. popup_init debe ser usada una ventanas popup. Esta es usada como contexto de infomaci<63>n sensitiva, como
vez hasta arriba de cada pagina donde usted planea usar la funci<63>n ventanas de ayuda o herramientas. {popup_init} debe ser usada una vez hasta
arriba de cada pagina donde usted planea usar la funci<63>n
<link linkend="language.function.popup">popup</link>. <link linkend="language.function.popup">popup</link>.
overLib fue escrita por Erik Bosrup, y la pagina esta localizada en <ulink url="&url.overLib;">overLib</ulink> fue escrita por Erik Bosrup, y la
http://www.bosrup.com/web/overlib/. pagina esta localizada en <ulink url="&url.overLib;">&url.overLib;</ulink>.
</para> </para>
<para> <para>
A partir da versi&oacute;n 2.1.2 de Smarty, overLib NO viene con la A partir da versi&oacute;n 2.1.2 de Smarty, overLib NO viene con la
distribuci<63>n. Descargar el overLib, coloque el archivo overlib.js distribuci<63>n. Descargar el overLib, coloque el archivo overlib.js
dentro de su document root e indique la ruta relativa en el par<61>metro dentro de su document root e indique la ruta relativa en el par<61>metro
"src" de popup_init. "src" de {popup_init}.
</para> </para>
<example> <example>
<title>popup_init</title> <title>popup_init</title>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
<head>
{* popup_init debe ser llamado una sola vez hasta arriba de la pagina *} {* popup_init debe ser llamado una sola vez hasta arriba de la pagina *}
{popup_init src="/javascripts/overlib.js"} {popup_init src="/javascripts/overlib.js"}
</head>
]]> ]]>
</programlisting> </programlisting>
</example> </example>

View File

@@ -88,8 +88,7 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry>Def<EFBFBD>ne el color del texto para ser usado <entry>Def<EFBFBD>ne el color del texto para ser usado en el texto principal</entry>
en el texto principal</entry>
</row> </row>
<row> <row>
<entry>captionfont</entry> <entry>captionfont</entry>
@@ -263,8 +262,7 @@
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>n/a</emphasis></entry> <entry><emphasis>n/a</emphasis></entry>
<entry> <entry> Indica al overLib desde que <20>ndice de la
Indica al overLib desde que <20>ndice de la
matriz ol_text debe leer el texto, localizada en overlib.js. matriz ol_text debe leer el texto, localizada en overlib.js.
Este par<61>metro puede ser usado en vez del texto Este par<61>metro puede ser usado en vez del texto
</entry> </entry>
@@ -396,22 +394,31 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
popup es usado para crear ventanas popup con javascript. {popup} es usado para crear ventanas popup con javascript.
<link linkend="language.function.popup.init">{popup_init}</link> DEBE ser
llamado primero para poder trabajar.
</para> </para>
<example> <example>
<title>popup</title> <title>popup</title>
<programlisting> <programlisting>
<![CDATA[
{* popup_init debe ser llamado una vez hasta arriba de la pagina *} {* popup_init debe ser llamado una vez hasta arriba de la pagina *}
{popup_init src="/javascripts/overlib.js"} {popup_init src="/javascripts/overlib.js"}
{* crea un link con una ventana popup que aparece cuando se pasa el mouse {* crea un link con una ventana popup que aparece cuando se pasa el mouse sobre este *}
sobre este *} <a href="mypage.html" {popup text="This link takes you to my page!"}>mypage</a>
&lt;A href="mypage.html" {popup text="This link takes you to my page!"}&gt;mypage&lt;/A&gt;
{* usted puede usar html, links, etc en el texto del popup *} {* usted puede usar html, links, etc en el texto del popup *}
&lt;A href="mypage.html" {popup sticky=true caption="mypage contents" <a href="mypage.html" {popup sticky=true caption="mypage contents"
text="&lt;UL&gt;&lt;LI&gt;links&lt;LI&gt;pages&lt;LI&gt;images&lt;/UL&gt;" snapx=10 snapy=10}&gt;mypage&lt;/A&gt;</programlisting> text="<ul><li>links</li><li>pages</li><li>images</li></ul>"
snapx=10 snapy=10}>mypage</a>
]]>
</programlisting>
</example> </example>
<para>
Ver tambi<62>n <link linkend="language.function.popup.init">{popup_init}</link>
y <ulink url="&url.overLib;">overLib</ulink>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<sect1 id="language.function.textformat"> <sect1 id="language.function.textformat">
<title>textformat</title> <title>{textformat}</title>
<informaltable frame="all"> <informaltable frame="all">
<tgroup cols="5"> <tgroup cols="5">
<colspec colname="param" align="center" /> <colspec colname="param" align="center" />
@@ -81,19 +81,18 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
textformat es una funci<EFBFBD>n de bloque usada para formatear texto. {textformat} es una <link linkend="plugins.block.functions">funci<EFBFBD>n de bloque</link>
B<>sicamente limpa espacios y caracteres especiales, y formatea usada para formatear texto. B<>sicamente limpa espacios y caracteres especiales, y
los p<>rrafos cortando el texto al final de la palabra y endentando formatea los p<>rrafos cortando el texto al final de la palabra y endentando lineas.
lineas.
</para> </para>
<para> <para>
Usted puede definir los par<61>metros expl<70>citamente, o usar un Usted puede definir los par<61>metros expl<70>citamente, o usar un estilo pre-definido.
estilo pre-definido.
Actualmente el <20>nico estilo disponible es "email". Actualmente el <20>nico estilo disponible es "email".
</para> </para>
<example> <example>
<title>textformat</title> <title>{textformat}</title>
<programlisting> <programlisting>
<![CDATA[
{textformat wrap=40} {textformat wrap=40}
This is foo. This is foo.
@@ -115,7 +114,13 @@ bar foo bar foo foo.
{/textformat} {/textformat}
SALIDA: ]]>
</programlisting>
<para>
Salida del ajemplo de arriba:
</para>
<screen>
<![CDATA[
This is foo. This is foo. This is foo. This is foo. This is foo. This is foo.
This is foo. This is foo. This is foo. This is foo. This is foo. This is foo.
@@ -126,8 +131,10 @@ bar foo bar foo foo. bar foo bar foo
foo. bar foo bar foo foo. bar foo bar foo. bar foo bar foo foo. bar foo bar
foo foo. bar foo bar foo foo. bar foo foo foo. bar foo bar foo foo. bar foo
bar foo foo. bar foo bar foo foo. bar foo foo. bar foo bar foo foo.
]]>
</screen>
<programlisting>
<![CDATA[
{textformat wrap=40 indent=4} {textformat wrap=40 indent=4}
This is foo. This is foo.
@@ -149,7 +156,13 @@ bar foo bar foo foo.
{/textformat} {/textformat}
SALIDA: ]]>
</programlisting>
<para>
Salida del ejemplo de arriba:
</para>
<screen>
<![CDATA[
This is foo. This is foo. This is This is foo. This is foo. This is
foo. This is foo. This is foo. This foo. This is foo. This is foo. This
@@ -162,7 +175,10 @@ SALIDA:
bar foo foo. bar foo bar foo foo. bar foo foo. bar foo bar foo foo.
bar foo bar foo foo. bar foo bar bar foo bar foo foo. bar foo bar
foo foo. foo foo.
]]>
</screen>
<programlisting>
<![CDATA[
{textformat wrap=40 indent=4 indent_first=4} {textformat wrap=40 indent=4 indent_first=4}
This is foo. This is foo.
@@ -183,8 +199,13 @@ bar foo bar foo foo.
bar foo bar foo foo. bar foo bar foo foo.
{/textformat} {/textformat}
]]>
SALIDA: </programlisting>
<para>
Salida del ejemplo de arriba:
</para>
<screen>
<![CDATA[
This is foo. This is foo. This This is foo. This is foo. This
is foo. This is foo. This is foo. is foo. This is foo. This is foo.
@@ -197,7 +218,10 @@ SALIDA:
foo bar foo foo. bar foo bar foo foo bar foo foo. bar foo bar foo
foo. bar foo bar foo foo. bar foo foo. bar foo bar foo foo. bar foo
bar foo foo. bar foo foo.
]]>
</screen>
<programlisting>
<![CDATA[
{textformat style="email"} {textformat style="email"}
This is foo. This is foo.
@@ -219,7 +243,13 @@ bar foo bar foo foo.
{/textformat} {/textformat}
SALIDA: ]]>
</programlisting>
<para>
Salida del ejemplo de arriba:
</para>
<screen>
<![CDATA[
This is foo. This is foo. This is foo. This is foo. This is foo. This is This is foo. This is foo. This is foo. This is foo. This is foo. This is
foo. foo.
@@ -230,8 +260,15 @@ bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo
bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo foo. bar foo bar foo
foo. foo.
</programlisting> ]]>
</screen>
</example> </example>
<para>
Ver tambi<62>n
<link linkend="language.function.strip">{strip}</link>
y <link linkend="language.modifier.wordwrap">{wordwrap}</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -14,14 +14,21 @@
<title>Ejemplo de modificador</title> <title>Ejemplo de modificador</title>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{* Uppercase the title *} {* apply modifier to a variable *}
<h2>{$title|upper}</h2> {$title|upper}
{* modifier with parameters *}
{$title|truncate:40:"..."}
{* Truncate the topic to 40 characters use ... at the end *} {* apply modifier to a function parameter *}
Topic: {$topic|truncate:40:"..."} {html_table loop=$myvar|upper}
{* with parameters *}
{html_table loop=$myvar|truncate:40:"..."}
{* format a literal string *} {* apply modifier to literal string *}
{"now"|date_format:"%Y/%m/%d"} {"foobar"|upper}
{* using date_format to format the current date *}
{$smarty.now|date_format:"%Y/%m/%d"}
{* apply modifier to a custom function *} {* apply modifier to a custom function *}
{mailto|upper address="me@domain.dom"} {mailto|upper address="me@domain.dom"}
@@ -59,10 +66,18 @@ Topic: {$topic|truncate:40:"..."}
<link linkend="variable.security.settings">$security_settings['MODIFIER_FUNCS'] <link linkend="variable.security.settings">$security_settings['MODIFIER_FUNCS']
</link>. </link>.
</para> </para>
<para>
Ver tambi<62>n
<link linkend="api.register.modifier">register_modifier()</link>,
<link linkend="api.register.function">register_function()</link>,
<link linkend="plugins">Extending Smarty with plugins</link>
y <link linkend="plugins.modifiers">modifiers</link>,
</para>
&designers.language-modifiers.language-modifier-capitalize; &designers.language-modifiers.language-modifier-capitalize;
&designers.language-modifiers.language-modifier-count-characters;
&designers.language-modifiers.language-modifier-cat; &designers.language-modifiers.language-modifier-cat;
&designers.language-modifiers.language-modifier-count-characters;
&designers.language-modifiers.language-modifier-count-paragraphs; &designers.language-modifiers.language-modifier-count-paragraphs;
&designers.language-modifiers.language-modifier-count-sentences; &designers.language-modifiers.language-modifier-count-sentences;
&designers.language-modifiers.language-modifier-count-words; &designers.language-modifiers.language-modifier-count-words;

View File

@@ -40,15 +40,13 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'next x-men film, x3, delayed.'); $smarty->assign('articleTitle', 'next x-men film, x3, delayed.');
$smarty->display('index.tpl');
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Donde index.tpl es: Donde el template es:
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -58,7 +56,7 @@ $smarty->display('index.tpl');
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Esta es la Salida: Esta es la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -68,6 +66,9 @@ Next X-Men Film, X3, Delayed.
]]> ]]>
</screen> </screen>
</example> </example>
<para>Ver tambi<62>n <link linkend="language.modifier.lower">lower</link>
<link linkend="language.modifier.upper">upper</link>
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -11,11 +11,11 @@
<colspec colname="desc" /> <colspec colname="desc" />
<thead> <thead>
<row> <row>
<entry>Parameter Position</entry> <entry>Posiscion del Parametro</entry>
<entry>Type</entry> <entry>Tipo</entry>
<entry>Required</entry> <entry>Requerido</entry>
<entry>cat</entry> <entry>cat</entry>
<entry>Description</entry> <entry>Descripci<EFBFBD>n</entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
@@ -37,14 +37,14 @@
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('articleTitle', "Psychics predict world didn't end"); $smarty->assign('articleTitle', "Psychics predict world didn't end");
$smarty->display('index.tpl');
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Donde index.tpl es: Donde el template es:
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -52,7 +52,7 @@ $smarty->display('index.tpl');
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Salida: Esta es la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[

View File

@@ -39,15 +39,13 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Cold Wave Linked to Temperatures.'); $smarty->assign('articleTitle', 'Cold Wave Linked to Temperatures.');
$smarty->display('index.tpl');
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Donde index.tpl es: Donde el template es:
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -57,7 +55,7 @@ $smarty->display('index.tpl');
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Salida: esta es la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -67,6 +65,12 @@ Cold Wave Linked to Temperatures.
]]> ]]>
</screen> </screen>
</example> </example>
<para>
ver tambi<62>n
<link linkend="language.modifier.count.words">count_words</link>,
<link linkend="language.modifier.count.sentences">count_sentences</link> y
<link linkend="language.modifier.count.paragraphs">count_paragraphs</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -10,15 +10,17 @@
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('articleTitle', "War Dims Hope for Peace. Child's Death Ruins $smarty->assign('articleTitle',
Couple's Holiday.\n\nMan is Fatally Slain. Death Causes Loneliness, Feeling of Isolation."); "War Dims Hope for Peace. Child's Death Ruins Couple's Holiday.\n\n
$smarty->display('index.tpl'); Man is Fatally Slain. Death Causes Loneliness, Feeling of Isolation."
);
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Donde index.tpl es: Donde el template es:
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -27,7 +29,7 @@ $smarty->display('index.tpl');
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Esta es la Salida: Esta es la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -38,6 +40,11 @@ Man is Fatally Slain. Death Causes Loneliness, Feeling of Isolation.
]]> ]]>
</screen> </screen>
</example> </example>
<para>
ver tambi<62>n <link linkend="language.modifier.count.characters">count_characters</link>,
<link linkend="language.modifier.count.sentences">count_sentences</link> y
<link linkend="language.modifier.count.words">count_words</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -11,15 +11,16 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty; $smarty->assign('articleTitle',
$smarty->assign('articleTitle', 'Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe.'); 'Two Soviet Ships Collide - One Dies.
$smarty->display('index.tpl'); Enraged Cow Injures Farmer with Axe.'
);
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Donde index.tpl es: Donde el template es:
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -28,7 +29,7 @@ $smarty->display('index.tpl');
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Esta es la Salida: esta es la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -37,6 +38,11 @@ Two Soviet Ships Collide - One Dies. Enraged Cow Injures Farmer with Axe.
]]> ]]>
</screen> </screen>
</example> </example>
<para>
ver tambi<62>n <link linkend="language.modifier.count.characters">count_characters</link>,
<link linkend="language.modifier.count.paragraphs">count_paragraphs</link> y
<link linkend="language.modifier.count.words">count_words</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -11,15 +11,13 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.'); $smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
$smarty->display('index.tpl');
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Donde index.tpl es: Donde el template es:
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -28,7 +26,7 @@ $smarty->display('index.tpl');
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Esta es la Salida: esta es la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -37,6 +35,11 @@ Dealers Will Hear Car Talk at Noon.
]]> ]]>
</screen> </screen>
</example> </example>
<para>
ver tambi<62>n <link linkend="language.modifier.count.characters">count_characters</link>,
<link linkend="language.modifier.count.paragraphs">count_paragraphs</link> y
<link linkend="language.modifier.count.sentences">count_sentences</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -39,11 +39,14 @@
</informaltable> </informaltable>
<para> <para>
Estos formatos de fecha y hora estan dentro del formato determinado Estos formatos de fecha y hora estan dentro del formato determinado
strftime(). Las fechas pueden ser pasadas a Smarty como timestamps <ulink url="&url.php-manual;strftime">strftime()</ulink>.
Las fechas pueden ser pasadas a Smarty como <ulink
url="&url.php-manual;function.time">timestamps</ulink>
unix, timestamps mysql, o como cualquier cadena compuesta de mes dia unix, timestamps mysql, o como cualquier cadena compuesta de mes dia
a<>o (pasada por strtotime). El dise<73>ador puede usar entonces date_format a<>o (pasada por <ulink url="&url.php-manual;strtotime">strtotime()</ulink>).
para tener un control completo del formateo de la fecha. Si la fecha El dise<73>ador puede usar entonces date_format para tener un control completo
pasada para date_format estuviera vacia y un segundo par<61>metro fuera del formateo de la fecha. Si la fecha pasada para
<command>date_format</command> estuviera vacia y un segundo par<61>metro fuera
pasado, este ser<65> usado como la fecha a formatear. pasado, este ser<65> usado como la fecha a formatear.
</para> </para>
<example> <example>
@@ -52,34 +55,32 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('yesterday', strtotime('-1 day')); $smarty->assign('yesterday', strtotime('-1 day'));
$smarty->display('index.tpl');
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Donde index.tpl es: Where template is (uses <link linkend="language.variables.smarty.now">$smarty.now</link>):
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{$smarty.now|date_format} {$smarty.now|date_format}
{$smarty.now|date_format:"%A, %B %e, %Y"} {$smarty.now|date_format:"%D"}
{$smarty.now|date_format:"%H:%M:%S"} {$smarty.now|date_format:"%I:%M %p"}
{$yesterday|date_format} {$yesterday|date_format}
{$yesterday|date_format:"%A, %B %e, %Y"} {$yesterday|date_format:"%A, %B %e, %Y"}
{$yesterday|date_format:"%H:%M:%S"} {$yesterday|date_format:"%H:%M:%S"}
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Esta es la Salida: This will output:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
Feb 6, 2001 Feb 6, 2001
Tuesday, February 6, 2001 02/06/01
14:33:00 02:33 pm
Feb 5, 2001 Feb 5, 2001
Monday, February 5, 2001 Monday, February 5, 2001
14:33:00 14:33:00
@@ -87,7 +88,7 @@ Monday, February 5, 2001
</screen> </screen>
</example> </example>
<para> <para>
date_format especificadores de conversi<73>n: <command>date_format</command> especificadores de conversi<73>n:
<itemizedlist> <itemizedlist>
<listitem><para> <listitem><para>
%a - nombre del d<>a de la semana abreviado de acuerdo al local actual %a - nombre del d<>a de la semana abreviado de acuerdo al local actual
@@ -105,8 +106,7 @@ Monday, February 5, 2001
%c - Representaci<63>n preferencial de la fecha y hora local actual %c - Representaci<63>n preferencial de la fecha y hora local actual
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
%C - a<>o con dos d<>gitos (o a<>o dividido por 100 y truncadopara un entero, %C - a<>o con dos d<>gitos (o a<>o dividido por 100 y truncadopara un entero, intervalo de 00 a 99)
intervalo de 00 a 99)
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
%d - d<>a del mes como un n<>mero decimal (intervalo de 00 a 31) %d - d<>a del mes como un n<>mero decimal (intervalo de 00 a 31)
@@ -128,18 +128,16 @@ Monday, February 5, 2001
%h - Lo mismo que %b %h - Lo mismo que %b
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
%H - Hora como un n<>mero decimal usando un rel<65>j de 24 horas (intervalo %H - Hora como un n<>mero decimal usando un rel<65>j de 24 horas (intervalo de 00 a 23)
de 00 a 23)
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
%I - Hora como un n<>mero decimal usando un rel<65>j de 12 horas (intervalo %I - Hora como un n<>mero decimal usando un rel<65>j de 12 horas (intervalo de 01 a 12)
de 01 a 12)
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
%j - D<>a del a<>o como um n<>mero decimal (intervalo de 001 a 366) %j - D<>a del a<>o como um n<>mero decimal (intervalo de 001 a 366)
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
%k - Hora (rel<65>j de 24 horas) dig<69>tos <20>nicos que son precedidos por um %k - Hora (rel<65>j de 24 horas) dig<69>tos <20>nicos que son precedidos por un
espacio en blanco (intervalo de 0 a 23) espacio en blanco (intervalo de 0 a 23)
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
@@ -175,8 +173,7 @@ Monday, February 5, 2001
%T - Hora actual, igual a %H:%M:%S %T - Hora actual, igual a %H:%M:%S
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
%u - D<>a de la semana como un n<>mero decimal [1,7], representando %u - D<>a de la semana como un n<>mero decimal [1,7], representando con 1 el lunes
con 1 el lunes
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
%U - N<>mero de la semana del a<>o actual como un n<>mero decimal, %U - N<>mero de la semana del a<>o actual como un n<>mero decimal,
@@ -189,7 +186,7 @@ Monday, February 5, 2001
domingo el primer dia de la semana. domingo el primer dia de la semana.
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
%w - D&iacute;a de la semana como decimal, siendo domingo 0 %w - D<EFBFBD>a de la semana como decimal, siendo domingo 0
</para></listitem> </para></listitem>
<listitem><para> <listitem><para>
%W - N<>mero de la semana del a<>o actual como n<>mero decimal, %W - N<>mero de la semana del a<>o actual como n<>mero decimal,
@@ -217,14 +214,21 @@ Monday, February 5, 2001
<note> <note>
<title>NOTA PARA PROGRAMADORES:</title> <title>NOTA PARA PROGRAMADORES:</title>
<para> <para>
date_format es escencialmente una envoltura para la funci<EFBFBD>n strftime() <command>date_format</command> es escencialmente una envoltura para la
de PHP. Usted debera tener mas o menos especificadores de conversiones funci<EFBFBD>n <ulink url="&url.php-manual;strftime">strftime()</ulink> de PHP.
disponibles de acuerdo con la funci<63>n strftime() del sistema operacional Usted debera tener mas o menos especificadores de conversiones disponibles
en donde PHP fue compilado. Cheque en la pagina del manual de su sistema de acuerdo con la funci<63>n <ulink url="&url.php-manual;strftime">strftime()</ulink>
una lista completa de especificadores validos. del sistema operacional en donde PHP fue compilado. Cheque en la pagina
del manual de su sistema una lista completa de especificadores validos.
</para> </para>
</note> </note>
</para> </para>
<para>
Ver tambi<62>n <link linkend="language.variables.smarty.now">$smarty.now</link>,
<ulink url="&url.php-manual;strftime">php function strftime()</ulink>,
<link linkend="language.function.html.select.date">{html_select_date}</link>
y <link linkend="tips.dates">date tips</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -41,15 +41,13 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.'); $smarty->assign('articleTitle', 'Dealers Will Hear Car Talk at Noon.');
$smarty->display('index.tpl');
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Donde index.tpl es: Donde el template es:
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -58,7 +56,7 @@ $smarty->display('index.tpl');
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Esta es la Salida: Esta es la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -67,6 +65,10 @@ no title
]]> ]]>
</screen> </screen>
</example> </example>
<para>
Ver tambi<62>n <link linkend="tips.default.var.handling">Default Variable Handling</link>
y <link linkend="tips.blank.var.handling">Blank Variable Handling</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -43,15 +43,15 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty; $smarty->assign('articleTitle',
$smarty->assign('articleTitle', "'Stiff Opposition Expected to Casketless Funeral Plan'"); "'Stiff Opposition Expected to Casketless Funeral Plan'"
$smarty->display('index.tpl'); );
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Donde index.tpl es: Donde el template es:
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -65,7 +65,7 @@ $smarty->display('index.tpl');
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Esta es la Salida: esta es la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -75,10 +75,14 @@ $smarty->display('index.tpl');
&#039;Stiff Opposition Expected to Casketless Funeral Plan&#039; &#039;Stiff Opposition Expected to Casketless Funeral Plan&#039;
%27Stiff+Opposition+Expected+to+Casketless+Funeral+Plan%27 %27Stiff+Opposition+Expected+to+Casketless+Funeral+Plan%27
\'Stiff Opposition Expected to Casketless Funeral Plan\' \'Stiff Opposition Expected to Casketless Funeral Plan\'
<a href="mailto:%62%6f%62%40%6d%65%2e%6e%65%74">&#x62;&#x6f;&#x62;&#x40;&#x6d;&#x65;&#x2e;&#x6e;&#x65;&#x74;</a> <a href="mailto:%62%6f%..snip..%65%74">&#x62;&#x6f;&#x62..snip..&#x65;&#x74;</a>
]]> ]]>
</screen> </screen>
</example> </example>
<para>
Ver tambi<62>n <link linkend="language.escaping">Escaping Smarty Parsing</link>
y <link linkend="tips.obfuscating.email">Obfuscating E-mail Addresses</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -49,17 +49,18 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty; $smarty->assign('articleTitle',
$smarty->assign('articleTitle', 'NJ judge to rule on nude beach. 'NJ judge to rule on nude beach.
Sun or rain expected today, dark tonight. Sun or rain expected today, dark tonight.
Statistics show that teen pregnancy drops off significantly after 25.'); Statistics show that teen pregnancy drops off significantly after 25.'
$smarty->display('index.tpl'); );
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Donde index.tpl es: Donde el template es:
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -73,7 +74,7 @@ $smarty->display('index.tpl');
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Esta es la Salida: esta es la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -95,6 +96,10 @@ Statistics show that teen pregnancy drops off significantly after 25.
]]> ]]>
</screen> </screen>
</example> </example>
<para>
ver tambi<62>n <link linkend="language.modifier.strip">strip</link>
y <link linkend="language.modifier.spacify">spacify</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -11,15 +11,13 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Two Convicts Evade Noose, Jury Hung.'); $smarty->assign('articleTitle', 'Two Convicts Evade Noose, Jury Hung.');
$smarty->display('index.tpl');
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Donde index.tpl es: Donde el template es:
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -28,7 +26,7 @@ $smarty->display('index.tpl');
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Esta es la Salida: esta es la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -37,6 +35,10 @@ two convicts evade noose, jury hung.
]]> ]]>
</screen> </screen>
</example> </example>
<para>
ver tambi<62>n <link linkend="language.modifier.upper">upper</link> y
<link linkend="language.modifier.capitalize">Capitalize</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -3,8 +3,9 @@
<sect1 id="language.modifier.nl2br"> <sect1 id="language.modifier.nl2br">
<title>nl2br</title> <title>nl2br</title>
<para> <para>
Todos los saltos de linea seran convertidos a etiquetas &lt;br /&gt; como Todos los saltos de linea seran convertidos a etiquetas &lt;br /&gt;
datos de la variable. Esto equivale a la funci<63>n nl2br() de PHP. como datos de la variable. Esto equivale a la funci<63>n
<ulink url="&url.php-manual;nl2br">nl2br()</ulink> de PHP.
</para> </para>
<example> <example>
<title>nl2br</title> <title>nl2br</title>
@@ -12,15 +13,15 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty; $smarty->assign('articleTitle',
$smarty->assign('articleTitle', "Sun or rain expected\ntoday, dark tonight"); "Sun or rain expected\ntoday, dark tonight"
$smarty->display('index.tpl'); );
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Donde index.tpl es: Donde el template es:
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -28,7 +29,7 @@ $smarty->display('index.tpl');
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Esta es la Salida: esta debe ser la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -36,6 +37,11 @@ Sun or rain expected<br />today, dark tonight
]]> ]]>
</screen> </screen>
</example> </example>
<para>
Ver tambi<62>n <link linkend="language.modifier.wordwrap">word_wrap</link>,
<link linkend="language.modifier.count.paragraphs">count_paragraphs</link>
y <link linkend="language.modifier.count.sentences">count_sentences</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -37,8 +37,8 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
Localiza una expresi<73>n regular y la remplaza en la variable. Localiza una expresi<73>n regular y la remplaza en la variable. Use la sintaxis para
Use la sintaxis para preg_replace() del manual de PHP. <ulink url="&url.php-manual;preg_replace">preg_replace()</ulink> del manual de PHP.
</para> </para>
<example> <example>
<title>regex_replace</title> <title>regex_replace</title>
@@ -46,9 +46,7 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('articleTitle', "Infertility unlikely to\nbe passed on, experts say."); $smarty->assign('articleTitle', "Infertility unlikely to\nbe passed on, experts say.");
$smarty->display('index.tpl');
?> ?>
]]> ]]>
@@ -65,7 +63,7 @@ $smarty->display('index.tpl');
]]> ]]>
</programlisting> </programlisting>
<para> <para>
Esta es la Salida: Esta es la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -75,6 +73,10 @@ Infertility unlikely to be passed on, experts say.
]]> ]]>
</screen> </screen>
</example> </example>
<para>
Vea tambi<62>n <link linkend="language.modifier.replace">replace</link>
y <link linkend="language.modifier.escape">escape</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -37,7 +37,8 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
Una simple busqueda y substituir en la variable. Una simple busqueda y substituir en la variable. Esta es equivalente a la
funci<63>n <ulink url="&url.php-manual;str_replace">str_replace()</ulink> de PHP.
</para> </para>
<example> <example>
<title>replace</title> <title>replace</title>
@@ -45,9 +46,7 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('articleTitle', "Child's Stool Great for Use in Garden."); $smarty->assign('articleTitle', "Child's Stool Great for Use in Garden.");
$smarty->display('index.tpl');
?> ?>
]]> ]]>
@@ -73,6 +72,11 @@ Child's Stool Great for Use in Garden.
]]> ]]>
</screen> </screen>
</example> </example>
<para>
ver tambi<62>n <link linkend="language.modifier.regex.replace">regex_replace</link>
y <link linkend="language.modifier.escape">escape</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -38,9 +38,9 @@
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Something Went Wrong in Jet Crash, Experts Say.'); $smarty->assign('articleTitle', 'Something Went Wrong in Jet Crash, Experts Say.');
$smarty->display('index.tpl');
?> ?>
]]> ]]>
</programlisting> </programlisting>
@@ -65,6 +65,10 @@ S^^o^^m^^e^^t^^h^^i^^n^^g^^ ^^W^^e^^n^^t^^ ^^W^^r^^o^^n^^g^^ ^^i^^n^^ ^^J^^e^^t^
]]> ]]>
</screen> </screen>
</example> </example>
<para>
Ver tambi<62>n <link linkend="language.modifier.wordwrap">wordwrap</link>
y <link linkend="language.modifier.nl2br">nl2br</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -31,7 +31,7 @@
</informaltable> </informaltable>
<para> <para>
Esta es una manera de formatear cadenas, como n<>meros decimales y otros. Esta es una manera de formatear cadenas, como n<>meros decimales y otros.
Use la sintaxis de sprintf para formatearlo. Use la sintaxis de <ulink url="&url.php-manual;sprintf">sprintf</ulink> para formatearlo.
</para> </para>
<example> <example>
<title>string_format</title> <title>string_format</title>
@@ -39,9 +39,7 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('number', 23.5787446); $smarty->assign('number', 23.5787446);
$smarty->display('index.tpl');
?> ?>
]]> ]]>
@@ -67,6 +65,9 @@ $smarty->display('index.tpl');
]]> ]]>
</screen> </screen>
</example> </example>
<para>
Ver tambi<62>n <link linkend="language.modifier.date.format">date_format</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -24,8 +24,7 @@
<entry>bool</entry> <entry>bool</entry>
<entry>No</entry> <entry>No</entry>
<entry>true</entry> <entry>true</entry>
<entry>Este determina cuando las etiquetas seran remplazadas por ' ' <entry>Este determina cuando las etiquetas seran remplazadas por ' ' o por ''</entry>
o por ''</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
@@ -39,10 +38,8 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('articleTitle', "Blind Woman Gets <font face=\"helvetica\">New $smarty->assign('articleTitle', "Blind Woman Gets <font face=\"helvetica\">New
Kidney</font> from Dad she Hasn't Seen in <b>years</b>."); Kidney</font> from Dad she Hasn't Seen in <b>years</b>.");
$smarty->display('index.tpl');
?> ?>
]]> ]]>

View File

@@ -10,7 +10,7 @@
<title>Nota</title> <title>Nota</title>
<para> <para>
Si usted quiere substituir bloques de texto de un template use la Si usted quiere substituir bloques de texto de un template use la
funci<63>n <link linkend="language.function.strip">strip</link>. funci<63>n <link linkend="language.function.strip">{strip}</link>.
</para> </para>
</note> </note>
<example> <example>

View File

@@ -31,7 +31,8 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry>...</entry> <entry>...</entry>
<entry>Este es el texto para adicionar si el truncamiento ocurre.</entry> <entry>Este es el texto para adicionar si el truncamiento ocurre. La
longitud NO se incluye para la logitud del truncamiento</entry>
</row> </row>
<row> <row>
<entry>3</entry> <entry>3</entry>
@@ -42,6 +43,15 @@
palabra(false), o un car<61>cter exacto(true). palabra(false), o un car<61>cter exacto(true).
</entry> </entry>
</row> </row>
<row>
<entry>3</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry>false</entry>
<entry>Este determina cuando ocurre el truncamiento al final de la cadena(false),
o en el centro de la cadena(true). Nota cuando este es true,
entonces la palabra limite es ignorada.</entry>
</row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </informaltable>
@@ -60,9 +70,7 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('articleTitle', 'Two Sisters Reunite after Eighteen Years at Checkout Counter.'); $smarty->assign('articleTitle', 'Two Sisters Reunite after Eighteen Years at Checkout Counter.');
$smarty->display('index.tpl');
?> ?>
]]> ]]>

View File

@@ -11,9 +11,7 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('articleTitle', "If Strike isn't Settled Quickly it may Last a While."); $smarty->assign('articleTitle', "If Strike isn't Settled Quickly it may Last a While.");
$smarty->display('index.tpl');
?> ?>
]]> ]]>
@@ -37,7 +35,12 @@ IF STRIKE ISN'T SETTLED QUICKLY IT MAY LAST A WHILE.
]]> ]]>
</screen> </screen>
</example> </example>
<para>
Ver tambi<62>n <link linkend="language.modifier.lower">lower</link> y
<link linkend="language.modifier.capitalize">capitalize</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
mode: sgml mode: sgml

View File

@@ -46,13 +46,13 @@
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
Este corta una cadena para un ancho de columna, el default es 80. Este <command>wordwrap</command> corta una cadena para un ancho de columna,
Como segundo par<61>metro opcional, usted puede especificar la cadena el default es 80. Como segundo par<61>metro opcional, usted puede especificar
que ser<65> usada para cortar el texto para la pr<70>xima linea (el default la cadena que ser<65> usada para cortar el texto para la pr<70>xima linea (el default
es un retorno de carro \n). es un retorno de carro \n). Por default, (wordwrap) intentara cortar al final
Por default, wordwrap intentara cortar al final de una palabra. Si de una palabra. Si usted quisiera cortar un tama<6D>o exacto de cacarteres,
usted quisiera cortar un tama<6D>o exacto de cacarteres, pase al pase al tercer par<61>metro, que es opcional, como true.
tercer par<61>metro, que es opcional, como true. Este es equivalente a la funci<63>n <ulink url="&url.php-manual;wordwrap">wordwrap()</ulink> de PHP.
</para> </para>
<example> <example>
<title>wordwrap</title> <title>wordwrap</title>
@@ -60,9 +60,7 @@
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('articleTitle', "Blind woman gets new kidney from dad she hasn't seen in years."); $smarty->assign('articleTitle', "Blind woman gets new kidney from dad she hasn't seen in years.");
$smarty->display('index.tpl');
?> ?>
]]> ]]>
@@ -109,6 +107,10 @@ years.
]]> ]]>
</screen> </screen>
</example> </example>
<para>
Ver Tambi<62>n <link linkend="language.modifier.nl2br">nl2br</link>
y <link linkend="language.function.textformat">{textformat}</link>.
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -7,11 +7,14 @@
depende de cual simbolo este prefijado(incluido dentro). depende de cual simbolo este prefijado(incluido dentro).
</para> </para>
<para> <para>
Las variables de Smarty no pueden ser mostradas directamente o usadas Las variables de Smarty no pueden ser mostradas directamente
como argumentos para atributos de funciones y modificadores, dentro de o usadas como argumentos para
expresiones condicionales, etc. Para mostrar una variable, simplesmente <link linkend="language.syntax.attributes">atributos</link>,
coloque esta entre delimitadores siendo esta la <20>nica cosa entre ellos. <link linkend="language.syntax.functions">funciones</link> y
Ejemplos: <link linkend="language.modifiers">modificadores</link>, dentro
de expresiones condicionales, etc. Para mostrar una variable,
simplesmente coloque esta entre delimitadores siendo esta la <20>nica
cosa entre ellos. Ejemplos:
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{$Name} {$Name}

View File

@@ -3,34 +3,57 @@
<sect1 id="language.assigned.variables"> <sect1 id="language.assigned.variables">
<title>Variables definidas desde PHP</title> <title>Variables definidas desde PHP</title>
<para> <para>
Las variables que son definidas desde PHP son referenciadas precedendo Las variables que son <link linkend="api.assign">asignadas</link> desde PHP
estas con una se<73>al de cifrado <literal>$</literal>. Las variables son referenciadas precedidas estas con una se<73>al de cifrado <literal>$</literal>.
definidas dentro del template como una funci<63>n Las variables definidas dentro del template como una funci<63>n
<link linkend="language.function.assign">assign</link> tambi<62>n son <link linkend="language.function.assign">assign</link> tambi<62>n son
mostradas de esta manera. mostradas de esta manera.
</para> </para>
<example> <example>
<title>variables definidas</title> <title>variables definidas</title>
<programlisting> <para> php script</para>
<programlisting role="php">
<![CDATA[ <![CDATA[
Hello {$firstname}, glad to see you could make it. <?php
<br />
Your last login was on {$lastLoginDate}. $smarty = new Smarty;
$smarty->assign('firstname', 'Doug');
$smarty->assign('lastname', 'Evans');
$smarty->assign('meetingPlace', 'New York');
$smarty->display('index.tpl');
?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
This will output: Donde el contenido de index.tpl es:
</para>
<programlisting>
<![CDATA[
Hello {$firstname} {$lastname}, glad to see you can make it.
<br />
{* this will not work as $vars are case sensitive *}
This weeks meeting is in {$meetingplace}.
{* this will work *}
This weeks meeting is in {$meetingPlace}.
]]>
</programlisting>
<para>
esta es la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
Hello Doug, glad to see you could make it. Hello Doug Evans, glad to see you can make it.
<br /> <br />
Your last login was on January 11th, 2001. This weeks meeting is in .
This weeks meeting is in New York.
]]> ]]>
</screen> </screen>
</example> </example>
<sect2 id="language.variables.assoc.arrays"> <sect2 id="language.variables.assoc.arrays">
<title>Arreglos asociativos</title> <title>Arreglos asociativos</title>
<para> <para>
@@ -43,18 +66,19 @@ Your last login was on January 11th, 2001.
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
$smarty = new Smarty;
$smarty->assign('Contacts', $smarty->assign('Contacts',
array('fax' => '555-222-9876', array('fax' => '555-222-9876',
'email' => 'zaphod@slartibartfast.com', 'email' => 'zaphod@slartibartfast.com',
'phone' => array('home' => '555-444-3333', 'phone' => array('home' => '555-444-3333',
'cell' => '555-111-1234'))); 'cell' => '555-111-1234')
)
);
$smarty->display('index.tpl'); $smarty->display('index.tpl');
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
where the content of index.tpl is: Donde el contenido de index.tpl es:
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -66,7 +90,7 @@ $smarty->display('index.tpl');
]]> ]]>
</programlisting> </programlisting>
<para> <para>
this will output: esta es la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -89,20 +113,18 @@ zaphod@slartibartfast.com<br />
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
$smarty->assign('Contacts', array(
$smarty = new Smarty; '555-222-9876',
$smarty->assign('Contacts',
array('555-222-9876',
'zaphod@slartibartfast.com', 'zaphod@slartibartfast.com',
array('555-444-3333', array('555-444-3333',
'555-111-1234'))); '555-111-1234')
));
$smarty->display('index.tpl'); $smarty->display('index.tpl');
?> ?>
]]> ]]>
</programlisting> </programlisting>
<para> <para>
where index.tpl is: Donde index.tpl es:
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -114,7 +136,7 @@ $smarty->display('index.tpl');
]]> ]]>
</programlisting> </programlisting>
<para> <para>
This will output: esta es la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -127,14 +149,14 @@ zaphod@slartibartfast.com<br />
</example> </example>
</sect2> </sect2>
<sect2 id="language.variables.objects"> <sect2 id="language.variables.objects">
<title>Objetos</title> <title>Objects</title>
<para> <para>
Las propiedades de los objetos definidos desde PHP pueden ser Las propiedades de los <link linkend="advanced.features.objects">objetos</link>
referenciados especificando el nombre de la propiedad despu<EFBFBD>;s definidos desde PHP pueden ser referenciados especificando el nombre de la propiedad
del simbolo '-&gt;'. despu<EFBFBD>s del simbolo '-&gt;'.
</para> </para>
<example> <example>
<title>Accesando propiedades de objetos</title> <title>Accesando propiedades de los Objetos</title>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
name: {$person->name}<br /> name: {$person->name}<br />
@@ -142,7 +164,7 @@ email: {$person->email}<br />
]]> ]]>
</programlisting> </programlisting>
<para> <para>
this will output: esta es la salida:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -153,6 +175,7 @@ email: zaphod@slartibartfast.com<br />
</example> </example>
</sect2> </sect2>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
mode: sgml mode: sgml

View File

@@ -3,7 +3,8 @@
<sect1 id="language.config.variables"> <sect1 id="language.config.variables">
<title>Variables cargadas desde archivos de configuraci<63>n</title> <title>Variables cargadas desde archivos de configuraci<63>n</title>
<para> <para>
Las variables que son cargadas de archivos de configuraci<63>n son Las variables que son cargadas de
<link linkend="config.files">archivos de configuraci<63>n</link> son
referenciadas incluyendo entre ellas el signo(#), o como variables referenciadas incluyendo entre ellas el signo(#), o como variables
de Smarty de Smarty
<link linkend="language.variables.smarty.config">$smarty.config</link>. <link linkend="language.variables.smarty.config">$smarty.config</link>.
@@ -45,7 +46,7 @@ rowBgColor = "#cccccc"
]]> ]]>
</programlisting> </programlisting>
<para> <para>
index.tpl: (alternate syntax) index.tpl: (sintaxis alternativa)
</para> </para>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
@@ -65,7 +66,7 @@ rowBgColor = "#cccccc"
]]> ]]>
</programlisting> </programlisting>
<para> <para>
this will output for both examples: esta es la salida de ambos ejemplos:
</para> </para>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -89,8 +90,13 @@ rowBgColor = "#cccccc"
usadas hasta despu<70>s de que son cargadas por los archivos de usadas hasta despu<70>s de que son cargadas por los archivos de
configuraci<63>n. configuraci<63>n.
Este procedimento es explicado posteriormente en este documento en Este procedimento es explicado posteriormente en este documento en
<command>config_load</command>. <link linkend="language.function.config.load"><command>{config_load}</command></link>.
</para> </para>
<para>
Ver tambi<62>n <link linkend="language.syntax.variables">Variables</link> y
<link linkend="language.variables.smarty">$smarty reserved variables</link>
</para>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -10,11 +10,14 @@
<sect2 id="language.variables.smarty.request"> <sect2 id="language.variables.smarty.request">
<title>Solicitud de Variables</title> <title>Solicitud de Variables</title>
<para> <para>
La solicitud de variables como get, post, cookies, server, environment, y La <ulink url="&url.php-manual;reserved.variables">solicitud de variables</ulink>
session pueden ser accesadas como se muestra en los ejemplos de abajo: como $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV y $_SESSION
(Ver <link linkend="variable.request.vars.order">$request_vars_order</link>
y <link linkend="variable.request.use.auto.globals">$request_use_auto_globals</link>)
pueden ser accesadas como se muestra en los ejemplos de abajo:
</para> </para>
<example> <example>
<title>Mostrando peticiones de variables</title> <title>Mostrando solicitud de variables</title>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
{* display value of page from URL (GET) http://www.domain.com/index.php?page=foo *} {* display value of page from URL (GET) http://www.domain.com/index.php?page=foo *}
@@ -52,10 +55,12 @@
<sect2 id="language.variables.smarty.now"> <sect2 id="language.variables.smarty.now">
<title>{$smarty.now}</title> <title>{$smarty.now}</title>
<para> <para>
El timestamp actual puede ser accesado con {$smarty.now}. El <ulink url="&url.php-manual;function.time">timestamp</ulink>
El n<>mero refleja el n<>mero de segundos pasados desde la actual puede ser accesado con {$smarty.now}. El n<>mero refleja el
llamada Epoca (1 de Enero de 1970) y puede ser pasado directamente n<EFBFBD>mero de segundos pasados desde la llamada Epoca (1 de Enero de 1970)
para el modificador date_format para mostrar la fecha. y puede ser pasado directamente para el modificador
<link linkend="language.modifier.date.format">date_format</link> para
mostrar la fecha.
</para> </para>
<example> <example>
<title>Usando {$smarty.now}</title> <title>Usando {$smarty.now}</title>
@@ -70,7 +75,9 @@
<sect2 id="language.variables.smarty.const"> <sect2 id="language.variables.smarty.const">
<title>{$smarty.const}</title> <title>{$smarty.const}</title>
<para> <para>
Usted puede accesar el valor de constantes PHP directamente. Usted puede accesar al valor de constantes PHP directamente.
Ver tambi<62>n <link linkend="smarty.constants">smarty constants</link>
</para> </para>
<example> <example>
<title>Usando {$smarty.const}</title> <title>Usando {$smarty.const}</title>
@@ -85,9 +92,10 @@
<sect2 id="language.variables.smarty.capture"> <sect2 id="language.variables.smarty.capture">
<title>{$smarty.capture}</title> <title>{$smarty.capture}</title>
<para> <para>
La salida capturada via {capture}..{/capture} puede ser accesada La salida capturada via
usando la variable {$smarty}. <link linkend="language.function.capture">{capture}..{/capture}</link>
vea la secci<63>n <link linkend="language.function.capture">capture</link> puede ser accesada usando la variable {$smarty}.
vea la secci<63>n <link linkend="language.function.capture">{capture}</link>
para un ejemplo. para un ejemplo.
</para> </para>
</sect2> </sect2>
@@ -95,10 +103,10 @@
<sect2 id="language.variables.smarty.config"> <sect2 id="language.variables.smarty.config">
<title>{$smarty.config}</title> <title>{$smarty.config}</title>
<para> <para>
La variable {$smarty} puede ser usada para referir variables de La variable {$smarty} puede ser usada para referir
configuraci<EFBFBD>n cargadas. <link linkend="language.config.variables">variables de configuraci<63>n</link>
{$smarty.config.foo} es un sin<69>nimo para {#foo#}. vea la secci<63>n cargadas. {$smarty.config.foo} es un sin<69>nimo para {#foo#}. vea la secci<63>n
sobre <link linkend="language.function.config.load">config_load</link> sobre <link linkend="language.function.config.load">{config_load}</link>
para un ejemplo. para un ejemplo.
</para> </para>
</sect2> </sect2>
@@ -123,25 +131,20 @@
<sect2 id="language.variables.smarty.version"> <sect2 id="language.variables.smarty.version">
<title>{$smarty.version}</title> <title>{$smarty.version}</title>
<para> <para>
Esta variable contiene la versi<73>n Smarty con que es compilado el Esta variable contiene la versi<73>n Smarty con que es compilado el template.
template.
</para> </para>
</sect2> </sect2>
<sect2 id="language.variables.smarty.ldelim"> <sect2 id="language.variables.smarty.ldelim">
<title>{$smarty.ldelim}</title> <title>{$smarty.ldelim}, {$smarty.rdelim}</title>
<para> <para>
Esta variable es usada para imprimir literalmente el valor left-delimiter. Esta variable es usada para imprimir literalmente el valor left-delimiter y right-delimiter.
Ver tambien <link linkend="language.function.ldelim">{ldelim},{rdelim}</link>. Ver tambien <link linkend="language.function.ldelim">{ldelim},{rdelim}</link>.
</para> </para>
</sect2>
<sect2 id="language.variables.smarty.rdelim">
<title>{$smarty.rdelim}</title>
<para> <para>
Esta variable es usada para imprimir literalmente el valor right-delimiter. Ver tambi<62>n <link linkend="language.syntax.variables">Variables</link>
Ver tambien <link linkend="language.function.ldelim">{rdelim},{rdelim}</link>. y <link linkend="language.config.variables">Config Variables</link>
</para> </para>
</sect2> </sect2>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:

View File

@@ -11,7 +11,10 @@
contenido en la presentaci<63>n. contenido en la presentaci<63>n.
La mejor descripci<63>n esta en una situaci<63>n donde la aplicaci<63>n La mejor descripci<63>n esta en una situaci<63>n donde la aplicaci<63>n
del programador y la plantilla del dise<73>ador juegan diferentes roles, del programador y la plantilla del dise<73>ador juegan diferentes roles,
o en la mayoria de los casos no la misma persona. Por ejemplo: o en la mayoria de los casos no la misma persona.
</para>
<para>
Por ejemplo:
Digamos que usted crea una pagina web, es decir, despliega el articulo Digamos que usted crea una pagina web, es decir, despliega el articulo
de un diario. El encabezado del articulo, el rotulo, el autor y el de un diario. El encabezado del articulo, el rotulo, el autor y el
cuerpo son elementos del contenido, estos no contiene informaci<63>n de cuerpo son elementos del contenido, estos no contiene informaci<63>n de
@@ -31,6 +34,18 @@
plantilla puede hacer cambios sin que haya rompimiento con la aplicaci<63>n plantilla puede hacer cambios sin que haya rompimiento con la aplicaci<63>n
l<>gica. l<>gica.
</para> </para>
<para>
One design goal of Smarty is the separation of business logic and
presentation logic. This means templates can certainly contain logic under
the condition that it is for presentation only. Things such as including
other templates, altering table row colors, upper-casing a variable,
looping over an array of data and displaying it, etc. are all examples of
presentation logic. This does not mean that Smarty forces a separation of
business and presentation logic. Smarty has no knowledge of which is which,
so placing business logic in the template is your own doing. Also, if you
desire <emphasis>no</emphasis> logic in your templates you certainly can
do so by boiling the content down to text and variables only.
</para>
<para> <para>
Ahora un peque<75>o resumen sobre que no hace Smarty. Smarty no intenta Ahora un peque<75>o resumen sobre que no hace Smarty. Smarty no intenta
separar completamente la l<>gica de la plantilla. No hay problema entre la separar completamente la l<>gica de la plantilla. No hay problema entre la
@@ -158,7 +173,7 @@ Smarty.class.php
Smarty_Compiler.class.php Smarty_Compiler.class.php
Config_File.class.php Config_File.class.php
debug.tpl debug.tpl
/core/*.php (all of them) /internals/*.php (all of them)
/plugins/*.php (all of them) /plugins/*.php (all of them)
]]> ]]>
</screen> </screen>
@@ -166,11 +181,11 @@ debug.tpl
<para> <para>
Smarty utiliza una constante de PHP llamada <link Smarty utiliza una constante de PHP llamada <link
linkend="constant.smarty.dir">SMARTY_DIR</link> que es la ruta para linkend="constant.smarty.dir">SMARTY_DIR</link> que es la ruta para
el directorio de la biblioteca de Smarty. Basicamente, si su el directorio de la biblioteca de Smarty 'libs/'. Basicamente, si su
aplicaci<63>n puede encontrar el archivo <emphasis>Smarty.class.php aplicaci<63>n puede encontrar el archivo <filename>Smarty.class.php
</emphasis>, usted no necesita definir SMARTY_DIR, Smarty lo </filename>, usted no necesita definir <link linkend="constant.smarty.dir">SMARTY_DIR</link>,
encontrar<61>. Por consiguiente si, <emphasis>Smarty.class.php Smarty lo encontrar<EFBFBD>. Por consiguiente si, <filename>Smarty.class.php
</emphasis> no esta incluido en el path, y no es abastecido por </filename> no esta incluido en el path, y no es abastecido por
una ruta absoluta para encontrar su aplicaci<63>n, entonces usted una ruta absoluta para encontrar su aplicaci<63>n, entonces usted
debe definir SMARTY_DIR manualmente. SMARTY_DIR <emphasis>debe debe definir SMARTY_DIR manualmente. SMARTY_DIR <emphasis>debe
</emphasis> incluir una barra de seguimento. </emphasis> incluir una barra de seguimento.
@@ -194,7 +209,7 @@ $smarty = new Smarty;
<para> <para>
Intente correr el script de arriba. Si usted obtiene un error diciendo que Intente correr el script de arriba. Si usted obtiene un error diciendo que
el archivo <emphasis>Smarty.class.php</emphasis> el archivo <filename>Smarty.class.php</filename>
no fue encontrado, puedes usar una de las siguientes opciones: no fue encontrado, puedes usar una de las siguientes opciones:
</para> </para>
@@ -216,11 +231,9 @@ $smarty = new Smarty;
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
// Edite su archivo php.ini, y adicione el directorio de la // Edite su archivo php.ini, y adicione el directorio de la libreria de Smarty
// biblioteca de Smarty
// include_path y reinicie su servidor web. // include_path y reinicie su servidor web.
// Entonces lo siguiente debe funcionar: // Entonces lo siguiente debe funcionar:
require('Smarty.class.php'); require('Smarty.class.php');
$smarty = new Smarty; $smarty = new Smarty;
?> ?>
@@ -244,19 +257,32 @@ $smarty = new Smarty;
<para> <para>
Ahora que la libreria de archivos esta en su sitio, es tiempo Ahora que la libreria de archivos esta en su sitio, es tiempo
de configurar los directorios de Smarty para su aplicaci<63>n. de configurar los directorios de Smarty para su aplicaci<63>n.
</para>
<para>
Smarty require cuatro directorios (por defaul) llamados Smarty require cuatro directorios (por defaul) llamados
<emphasis>templates</emphasis>, <emphasis>templates_c</emphasis>, <filename class="directory">'templates/'</filename>,
<emphasis>configs</emphasis> y <emphasis>cache</emphasis>. Cada <filename class="directory">'templates_c/'</filename>,
uno de estos son para definir las propiedades de las clases de Smarty. <filename class="directory">'configs/'</filename> y
<emphasis>$template_dir</emphasis>, <emphasis>$compile_dir</emphasis>, <filename class="directory">'cache/'</filename>.
<emphasis>$config_dir</emphasis>, y <emphasis>$cache_dir</emphasis> </para>
respectivamente. Es altamente recomendado que usted configure un grupo <para>
Cada uno de estos son para definir las propiedades de las clases de Smarty.
<link linkend="variable.template.dir">
<varname>$template_dir</varname></link>,
<link linkend="variable.compile.dir">
<varname>$compile_dir</varname></link>,
<link linkend="variable.config.dir">
<varname>$config_dir</varname></link>, y
<link linkend="variable.cache.dir">
<varname>$cache_dir</varname></link> respectivamente.
Es altamente recomendado que usted configure un grupo
separado de estos directorios para cada aplicaci<63>n que utilice de Smarty. separado de estos directorios para cada aplicaci<63>n que utilice de Smarty.
</para> </para>
<para> <para>
Asegurece que usted sabe la ubicaci<63>n del document root de su servidor Asegurece que usted sabe la ubicaci<63>n del document root de su servidor
web. En nuestro ejemplo, el document root esta en web. En nuestro ejemplo, el document root esta en
"/web/www.mydomain.com/docs/". Los directorios de Smarty solo son <filename class="directory">/web/www.example.com/docs/</filename>.
Los directorios de Smarty solo son
accesados por la libreria de Smarty y nunca son accesados directamente accesados por la libreria de Smarty y nunca son accesados directamente
por el navegador. Por consiguiente para evitar cualquier preocupaci<63>n por el navegador. Por consiguiente para evitar cualquier preocupaci<63>n
con la seguridad, es recomendado colocar estos directorios con la seguridad, es recomendado colocar estos directorios
@@ -269,13 +295,13 @@ $smarty = new Smarty;
Usted puede usar el mismo ambiente para cualquier aplicaci<63>n, solamente Usted puede usar el mismo ambiente para cualquier aplicaci<63>n, solamente
sustituya "guestbook" con el nombre de su aplicaci<63>n. sustituya "guestbook" con el nombre de su aplicaci<63>n.
Nosotros colocaremos nuestros directorios de Smarty dentro de Nosotros colocaremos nuestros directorios de Smarty dentro de
"/web/www.mydomain.com/smarty/guestbook/". <filename class="directory">/web/www.example.com/smarty/guestbook/</filename>.
</para> </para>
<para> <para>
Usted necesita tener por lo menos un archivo dentro de su document root, Usted necesita tener por lo menos un archivo dentro de su document root,
y que sea accesado por el navegador. Nosotros llamamos el script de y que sea accesado por el navegador. Nosotros llamamos el script de
"index.php", y lo colocamos en un subdirectorio dentro del document root <emphasis>'index.php'</emphasis>, y lo colocamos en un subdirectorio dentro del
llamado "/guestbook/". document root llamado <filename class="directory">/guestbook/</filename>.
</para> </para>
<note> <note>
@@ -283,11 +309,16 @@ $smarty = new Smarty;
<para> <para>
Es conveniente configurar el servidor de forma que "index.php" pueda Es conveniente configurar el servidor de forma que "index.php" pueda
ser identificado como el <20>ndice del direct<63>rio padre, de esta manera ser identificado como el <20>ndice del direct<63>rio padre, de esta manera
si usted accesa "http://www.mydomain.com/guestbook/", el script si usted accesa http://www.example.com/guestbook/, el script
index.php ser<65> ejecutado sin "index.php" ni la URL. index.php ser<65> ejecutado sin "index.php" ni la URL.
En Apache usted puede definir el sitio adicionando "index.php" en el En Apache usted puede definir el sitio adicionando "index.php" en el
final de su configuraci<63>n del directorio index final de su configuraci<63>n del directorio <emphasis>DirectoryIndex</emphasis>
(separando cada uno con espacios.) (separando cada uno con espacios.) como en el ejemplo de httpd.conf.
</para>
<para>
<emphasis>DirectoryIndex
index.htm index.html index.php index.php3 default.html index.cgi
</emphasis>
</para> </para>
</note> </note>
@@ -303,25 +334,27 @@ $smarty = new Smarty;
/usr/local/lib/php/Smarty/Smarty_Compiler.class.php /usr/local/lib/php/Smarty/Smarty_Compiler.class.php
/usr/local/lib/php/Smarty/Config_File.class.php /usr/local/lib/php/Smarty/Config_File.class.php
/usr/local/lib/php/Smarty/debug.tpl /usr/local/lib/php/Smarty/debug.tpl
/usr/local/lib/php/Smarty/core/*.php /usr/local/lib/php/Smarty/internals/*.php
/usr/local/lib/php/Smarty/plugins/*.php /usr/local/lib/php/Smarty/plugins/*.php
/web/www.mydomain.com/smarty/guestbook/templates/ /web/www.example.com/smarty/guestbook/templates/
/web/www.mydomain.com/smarty/guestbook/templates_c/ /web/www.example.com/smarty/guestbook/templates_c/
/web/www.mydomain.com/smarty/guestbook/configs/ /web/www.example.com/smarty/guestbook/configs/
/web/www.mydomain.com/smarty/guestbook/cache/ /web/www.example.com/smarty/guestbook/cache/
/web/www.mydomain.com/docs/guestbook/index.php /web/www.example.com/docs/guestbook/index.php
]]> ]]>
</screen> </screen>
</example> </example>
<para> <para>
Smarty necesitara permisos de escritura para Smarty necesitara <emphasis role="bold">permisos de escritura</emphasis>
<emphasis>$compile_dir</emphasis> y <emphasis>$cache_dir</emphasis>, (usuarios de windows ingnorar) para
<link linkend="variable.compile.dir"><emphasis>$compile_dir</emphasis></link> y
<link linkend="variable.cache.dir"><emphasis>$cache_dir</emphasis></link>,
esto garantiza que el usuario del servidor pueda escribir en ellos. esto garantiza que el usuario del servidor pueda escribir en ellos.
Este es generalmente el usuarios "nobody" y el grupo "nobody". Este es generalmente el usuarios "nobody" y el grupo "nobody".
Para X usuarios de sistema, el default es "www" y el grupo "www". Para usuarios con X sistema operativo, el default es "www" y el grupo "www".
Si usted esta usando Apache, puede ver en su archivo httpd.conf Si usted esta usando Apache, puede ver en su archivo httpd.conf
(normalmente en "/usr/local/apache/conf/") cual es el usuario y (normalmente en "/usr/local/apache/conf/") cual es el usuario y
grupo que estan siendo usados. grupo que estan siendo usados.
@@ -331,11 +364,11 @@ $smarty = new Smarty;
<title>Configurando permisos de archivos</title> <title>Configurando permisos de archivos</title>
<programlisting role="shell"> <programlisting role="shell">
<![CDATA[ <![CDATA[
chown nobody:nobody /web/www.mydomain.com/smarty/guestbook/templates_c/ chown nobody:nobody /web/www.example.com/smarty/guestbook/templates_c/
chmod 770 /web/www.mydomain.com/smarty/guestbook/templates_c/ chmod 770 /web/www.example.com/smarty/guestbook/templates_c/
chown nobody:nobody /web/www.mydomain.com/smarty/guestbook/cache/ chown nobody:nobody /web/www.example.com/smarty/guestbook/cache/
chmod 770 /web/www.mydomain.com/smarty/guestbook/cache/ chmod 770 /web/www.example.com/smarty/guestbook/cache/
]]> ]]>
</programlisting> </programlisting>
</example> </example>
@@ -353,11 +386,12 @@ chmod 770 /web/www.mydomain.com/smarty/guestbook/cache/
<para> <para>
Nosotros necesitamos crear el archivo index.tpl, para que Smarty lo Nosotros necesitamos crear el archivo index.tpl, para que Smarty lo
pueda cargar. Este estara localizado en su $template_dir. pueda cargar. Este estara localizado en su
<link linkend="variable.template.dir">$template_dir</link>.
</para> </para>
<example> <example>
<title>Editando /web/www.mydomain.com/smarty/guestbook/templates/index.tpl</title> <title>Editando /web/www.example.com/smarty/guestbook/templates/index.tpl</title>
<screen> <screen>
<![CDATA[ <![CDATA[
@@ -371,9 +405,9 @@ Hello, {$name}!
<note> <note>
<title>Nota T<>cnica:</title> <title>Nota T<>cnica:</title>
<para> <para>
{* Smarty *} Esto es un comentario en el template. {* Smarty *} Esto es un <link linkend="language.syntax.comments">comentario
Este no es obligatorio, pero si una buena practica iniciar todos sus </link> en el template. Este no es obligatorio, pero si una buena practica
archivos de plantilla con estos comentarios. iniciar todos sus archivos de plantilla con estos comentarios.
Esto hace facilmente reconocibles a los archivos a pesar la extenci<63>n Esto hace facilmente reconocibles a los archivos a pesar la extenci<63>n
del archivo. Por ejemplo, editores de texto pueden reconocer el archivo del archivo. Por ejemplo, editores de texto pueden reconocer el archivo
y habilitar un realce de sintaxis especial. y habilitar un realce de sintaxis especial.
@@ -390,7 +424,7 @@ Hello, {$name}!
</para> </para>
<example> <example>
<title>Editando /web/www.mydomain.com/docs/guestbook/index.php</title> <title>Editando /web/www.example.com/docs/guestbook/index.php</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -400,10 +434,10 @@ require('Smarty.class.php');
$smarty = new Smarty; $smarty = new Smarty;
$smarty->template_dir = '/web/www.mydomain.com/smarty/guestbook/templates/'; $smarty->template_dir = '/web/www.example.com/smarty/guestbook/templates/';
$smarty->compile_dir = '/web/www.mydomain.com/smarty/guestbook/templates_c/'; $smarty->compile_dir = '/web/www.example.com/smarty/guestbook/templates_c/';
$smarty->config_dir = '/web/www.mydomain.com/smarty/guestbook/configs/'; $smarty->config_dir = '/web/www.example.com/smarty/guestbook/configs/';
$smarty->cache_dir = '/web/www.mydomain.com/smarty/guestbook/cache/'; $smarty->cache_dir = '/web/www.example.com/smarty/guestbook/cache/';
$smarty->assign('name','Ned'); $smarty->assign('name','Ned');
@@ -418,18 +452,18 @@ $smarty->display('index.tpl');
<para> <para>
En nuestro ejemplo, estamos configurando rutas absolutas para todos En nuestro ejemplo, estamos configurando rutas absolutas para todos
los directorios de Smarty. los directorios de Smarty.
Si '/web/www.mydomain.com/smarty/guestbook/' est<73> dentro de su Si <filename class="directory">/web/www.example.com/smarty/guestbook/
include_path de PHP, entonces estas declaraciones no son necesarias. </filename> est<73> dentro de su include_path de PHP, entonces estas
Sin embargo, esto es mas eficiente y (por experiencia) tiene menos declaraciones no son necesarias. Sin embargo, esto es mas eficiente y
tendencia a errores en relaci<63>n a determinar las rutas absolutas. (por experiencia) tiene menos tendencia a errores en relaci<63>n a
Esto garantiza que Smarty esta recibiendo los archivos del directorio determinar las rutas absolutas. Esto garantiza que Smarty esta recibiendo
que usted desea. los archivos del directorio que usted desea.
</para> </para>
</note> </note>
<para> <para>
Ahora carge el archivo index.php desde su navegador web. Usted debera Ahora carge el archivo <filename>index.php</filename> desde su navegador web.
ver "Hello, Ned!" Usted debera ver "Hello, Ned!"
</para> </para>
<para> <para>
Usted a completado la configuracion basica para el Smarty! Usted a completado la configuracion basica para el Smarty!
@@ -447,8 +481,8 @@ $smarty->display('index.tpl');
clases e iniciar su ambiente de Smarty. Es, en vez de configurar rutas clases e iniciar su ambiente de Smarty. Es, en vez de configurar rutas
de directorios repetidamente, asigne esas mismas a variables, etc., de directorios repetidamente, asigne esas mismas a variables, etc.,
nosotros podemos facilitar eso. Vamos a crear un nuevo directorio en nosotros podemos facilitar eso. Vamos a crear un nuevo directorio en
"/php/includes/guestbook/" y llamemos al nuevo archivo "setup.php". "/php/includes/guestbook/" y llamemos al nuevo archivo <filename>setup.php
En nuestro ejemplo, "/php/includes" est<73> en nuestro include_path. </filename>. En nuestro ejemplo, "/php/includes" est<73> en nuestro include_path.
Verifique que usted tambi<62>n lo definio, o utilice rutas absolutas de Verifique que usted tambi<62>n lo definio, o utilice rutas absolutas de
los archivos. los archivos.
</para> </para>
@@ -472,14 +506,15 @@ class Smarty_GuestBook extends Smarty {
function Smarty_GuestBook() function Smarty_GuestBook()
{ {
// Class Constructor. These automatically get set with each new instance. // Class Constructor.
// These automatically get set with each new instance.
$this->Smarty(); $this->Smarty();
$this->template_dir = '/web/www.mydomain.com/smarty/guestbook/templates/'; $this->template_dir = '/web/www.example.com/smarty/guestbook/templates/';
$this->compile_dir = '/web/www.mydomain.com/smarty/guestbook/templates_c/'; $this->compile_dir = '/web/www.example.com/smarty/guestbook/templates_c/';
$this->config_dir = '/web/www.mydomain.com/smarty/guestbook/configs/'; $this->config_dir = '/web/www.example.com/smarty/guestbook/configs/';
$this->cache_dir = '/web/www.mydomain.com/smarty/guestbook/cache/'; $this->cache_dir = '/web/www.example.com/smarty/guestbook/cache/';
$this->caching = true; $this->caching = true;
$this->assign('app_name', 'Guest Book'); $this->assign('app_name', 'Guest Book');
@@ -496,7 +531,7 @@ class Smarty_GuestBook extends Smarty {
</para> </para>
<example> <example>
<title>Editando /web/www.mydomain.com/docs/guestbook/index.php</title> <title>Editando /web/www.example.com/docs/guestbook/index.php</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php

View File

@@ -1,24 +1,23 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<!ENTITY note.parameter.merge '<note> <!ENTITY note.parameter.merge '<note>
<title>Technical Note</title> <title>Nota Tecnica</title>
<para> <para>
The <parameter>merge</parameter> parameter respects array keys, so if El parametro <parameter>merge</parameter> es la llave respectiva del arreglo, asi si
you merge two numerically indexed arrays, they may overwrite each other usted asocia dos arreglos indexados numericamente, estos se sobre escriben uno al otro o
or result in non-sequential keys. This is unlike the array_merge() function tener como resultado llaves no-secuenciales. Este es diferente a la funcion array_merge() de PHP
of PHP which wipes out numerical keys and renumbers them. la cual limpia las llaves numericas y las vuelve a renumerar.
</para> </para>
</note>'> </note>'>
<!ENTITY parameter.compileid '<para> <!ENTITY parameter.compileid '<para>
As an optional third parameter, you can pass a <parameter>compile_id</parameter>. Como tercer parametro opcional, usted puede pasar <parameter>compile_id</parameter>.
This is in the event that you want to compile different versions of Este en el caso que usted quira compilar diferentes versiones del mismo Tempalte,
the same template, such as having separate templates compiled tal como tener separadas varios Templates compilados de diferentes lenguajes.
for different languages. Another use for compile_id is when you Otro uso para compile_id es cuando usted usa mas de un $template_dir pero solo un $compile_dir.
use more than one $template_dir but only one $compile_dir. Set Ponga separado <parameter>compile_id</parameter> por cada $template_dir, de otra manera
a separate <parameter>compile_id</parameter> for each $template_dir, otherwise los tempate con el mismo nombre se sobre escibiran uno sobre otro.
templates of the same name will overwrite each other. You can Uste puede poner tambi<62>n la variable <link linkend="variable.compile.id">$compile_id</link>
also set the <link una vez en lugar de pasar esta por cada llamada a la funci<63>n.
linkend="variable.compile.id">$compile_id</link> variable once
instead of passing this to each call to this function.
</para>'> </para>'>

37
docs/es/make_chm_index.html Executable file
View File

@@ -0,0 +1,37 @@
<HTML>
<!-- $Revision$ -->
<HEAD>
<TITLE>Manual de Smarty</TITLE>
<META NAME="HTTP_EQUIV" CONTENT="text/html; charset=ISO-8859-1">
<LINK REL="STYLESHEET" HREF="style.css">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" TOPMARGIN="0" LEFTMARGIN="0">
<TABLE BORDER="0" WIDTH="100%" HEIGHT="100%" CELLSPACING="0" CELLPADDING="0">
<TR><TD COLSPAN="3"><DIV CLASS="NAVHEADER"><TABLE BGCOLOR="#CCCCFF" BORDER="0"
CELLPADDING="0" CELLSPACING="0" WIDTH="100%"><TR><TD><TABLE WIDTH="100%" BORDER="0"
CELLPADDING="3" CELLSPACING="0"><TR><TH COLSPAN="3">Manual de Smarty</TH></TR><TR><TD
COLSPAN="3" ALIGN="center">&nbsp;</TD></TR></TABLE></TD></TR><TR BGCOLOR="#333366">
<TD><IMG SRC="spacer.gif" BORDER="0" WIDTH="1" HEIGHT="1"><BR></TD></TR></TABLE></DIV></TD></TR>
<TR><TD><IMG SRC="spacer.gif" WIDTH="10" HEIGHT="1"></TD><TD HEIGHT="100%" VALIGN="MIDDLE" WIDTH="100%"><BR>
<P><TABLE ALIGN="CENTER">
<TR><TD ALIGN="CENTER">
<H1 CLASS="title">Smarty Manual</H1>
<DIV CLASS="author">Monte Ohrt</DIV>
<DIV CLASS="author">Andrei Zmievski</DIV>
</TD></TR></TABLE>
<BR><P ALIGN="CENTER">This file was generated: [GENTIME]<BR>
Ir a <A HREF="http://smarty.php.net/download-docs.php">http://smarty.php.net/download-docs.php</A>
para obtener la version actual.</P>
<BR><P CLASS="copyright" ALIGN="CENTER">Copyright &copy; 2001 - 2005 New Digital Group, Inc.</P>
</TD><TD><IMG SRC="spacer.gif" WIDTH="10" HEIGHT="1"></TD></TR>
<TR><TD COLSPAN="3"><DIV CLASS="NAVFOOTER"><TABLE BGCOLOR="#CCCCFF" BORDER="0"
CELLPADDING="0" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#333366">
<TD><IMG SRC="spacer.gif" BORDER="0" WIDTH="1" HEIGHT="1"><BR></TD></TR>
<TR><TD><TABLE WIDTH="100%" BORDER="0" CELLPADDING="3" CELLSPACING="0">
<TR><TD COLSPAN="3">&nbsp;</TD></TR><TR><TD COLSPAN="3" ALIGN="center">&nbsp;</TD>
</TR></TABLE></TD></TR></TABLE></DIV></TD></TR></TABLE>
</BODY></HTML>

View File

@@ -4,21 +4,24 @@
<title>Objetos</title> <title>Objetos</title>
<para> <para>
El Smarty permite acceso a objetos de PHP a trav<61>s de sus templates. El Smarty permite acceso a objetos de PHP a trav<61>s de sus templates.
Hay dos formas de accesarlos. Una forma es registrando objetos para el Hay dos formas de accesarlos. Una forma es
<link linkend="api.register.object">registrando objetos</link> para el
template, entonces acceselos mediante sintaxis similar a las funciones template, entonces acceselos mediante sintaxis similar a las funciones
habituales. La otra es asignar objetos al template y accesarlos como si habituales. La otra es <link linkend="api.assign">asignar objetos</link> al
fueran una variable asignada. El primer m<>todo tiene una sintaxis de template y accesarlos como si fueran una variable asignada. El primer m<>todo
template mucho mas agradable. Y tambi<62>n mas segura, a medida que un tiene una sintaxis de template mucho mas agradable. Y tambi<62>n mas segura, a
objeto registrado puede ser reescrito a ciertos m<>todos y propiedades. medida que un objeto registrado puede ser reescrito a ciertos m<>todos y
Sin embargo tanto, un objeto registrado no puede ser puesto en loop o propiedades. Sin embargo tanto, <emphasis role="bold">un objeto registrado
ser asignado en arreglos de objetos, etc. El m<>todo que usted escoja no puede ser puesto en loop o ser asignado en arreglos de objetos</emphasis>,
sera determinado por sus necesidades, pero utilice el primero m<>todo si etc. El m<>todo que usted escoja sera determinado por sus necesidades, pero
es posible para mantener un minimo de sintaxis en el template. utilice el primero m<>todo si es posible para mantener un minimo de sintaxis
en el template.
</para> </para>
<para> <para>
Si la seguridad esta habilitada, ninguno de los dos m<>todos privados o Si <link linkend="variable.security">$security</link> esta habilitada,
funciones pueden ser accesados (comenzando con "_"). Si un metodo y ninguno de los dos m<>todos privados o funciones pueden ser accesados
propiedades de un mismo nombre existe, el m<>todo ser<65> usado. (comenzando con "_"). Si un metodo y propiedades de un mismo nombre existe,
el m<>todo ser<65> usado.
</para> </para>
<para> <para>
Usted puede restringir los m<>todos y propiedades que pueden ser accesados Usted puede restringir los m<>todos y propiedades que pueden ser accesados
@@ -26,12 +29,12 @@
</para> </para>
<para> <para>
Por default, los par<61>metros pasados a los objetos a a trav<61>s de los Por default, los par<61>metros pasados a los objetos a a trav<61>s de los
templates son pasados de la misma forma en que las funciones de templates son pasados de la misma forma en que las
costumbre los obtienen. Un arreglo asociativo es pasado como el primer <link linkend="language.custom.functions">funciones de costumbre</link>
par<EFBFBD>metro, y el objeto smarty como el segundo. Si usted quiere que los los obtienen. Un arreglo asociativo es pasado como el primer par<61>metro,
par<EFBFBD>metros pasados uno de cada vez por cada argumento pasen como y el objeto smarty como el segundo. Si usted quiere que los par<61>metros
par<EFBFBD>metros de un objeto tradicional, defina el cuarto par<61>metro de pasados uno de cada vez por cada argumento pasen como par<61>metros de un
registro en falso. objeto tradicional, defina el cuarto par<61>metro de registro en falso.
</para> </para>
<para> <para>
El quinto par<61>metro opcional solo tiene efecto con El quinto par<61>metro opcional solo tiene efecto con
@@ -41,10 +44,13 @@
etiqueta de cierre en el template etiqueta de cierre en el template
(<literal>{foobar->meth2}...{/foobar->meth2}</literal>) y (<literal>{foobar->meth2}...{/foobar->meth2}</literal>) y
los par<61>metros para los m<>todos tienen la misma sinopsis como los par<61>metros para los m<>todos tienen la misma sinopsis como
los par<61>metros de block-function-plugins: Ellos reciben 4 los par<61>metros de <link
par<EFBFBD>metros <parameter>$params</parameter>, linkend="plugins.block.functions">block-function-plugins</link>:
<parameter>$content</parameter>,<parameter>&amp;$smarty</parameter> Ellos reciben 4 par<EFBFBD>metros
y <parameter>&amp;$repeat</parameter> tambi<62>n se comportan como <parameter>$params</parameter>,
<parameter>$content</parameter>,
<parameter>&amp;$smarty</parameter> y
<parameter>&amp;$repeat</parameter> tambi<62>n se comportan como
block-function-plugins. block-function-plugins.
</para> </para>
<example> <example>
@@ -52,7 +58,7 @@
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
// El objeto // el objeto
class My_Object { class My_Object {
function meth1($params, &$smarty_obj) { function meth1($params, &$smarty_obj) {
@@ -61,27 +67,25 @@ class My_Object {
} }
$myobj = new My_Object; $myobj = new My_Object;
// registrando el objeto (ser<65> por referencia) // registrando el objeto (ser<65> por referencia)
$smarty->register_object("foobar",$myobj); $smarty->register_object("foobar",$myobj);
// Si usted quiere restringir acceso a ciertos metodos o propriedades, listelos
// Si usted quiere restringir acceso a ciertos metodos o propriedades,
// listelos
$smarty->register_object("foobar",$myobj,array('meth1','meth2','prop1')); $smarty->register_object("foobar",$myobj,array('meth1','meth2','prop1'));
// Si usted quiere usar el formato de par<61>metro del objeto tradicional, pase un booleano en false
// Si usted quiere usar el formato de par&aacute;metro del objeto tradicional,
// pase un booleano en false
$smarty->register_object("foobar",$myobj,null,false); $smarty->register_object("foobar",$myobj,null,false);
// tambi&eacute;n puede asignar ojetos. Posible cuando se asignan por // tambi<EFBFBD>n puede asignar ojetos. Posible cuando se asignan por referencia.
// referencia.
$smarty->assign_by_ref("myobj", $myobj); $smarty->assign_by_ref("myobj", $myobj);
$smarty->display("index.tpl"); $smarty->display("index.tpl");
?> ?>
]]>
TEMPLATE: </programlisting>
<para>
y como debera accesar a su objeto en index.tpl
</para>
<programlisting>
<![CDATA[
{* accesando a nuestro objeto registrado *} {* accesando a nuestro objeto registrado *}
{foobar->meth1 p1="foo" p2=$bar} {foobar->meth1 p1="foo" p2=$bar}

View File

@@ -26,7 +26,6 @@
<![CDATA[ <![CDATA[
<?php <?php
// ponga esto en su aplicaci<63>n // ponga esto en su aplicaci<63>n
function protect_email($tpl_output, &$smarty) function protect_email($tpl_output, &$smarty)
{ {
$tpl_output = $tpl_output =
@@ -41,7 +40,6 @@ $smarty->display("index.tpl");
// Ahora cualquier ocurrencia de una direcci&oacute;n de email en la salida // Ahora cualquier ocurrencia de una direcci&oacute;n de email en la salida
// del template tendra una simple protecci&oacute;n contra spambots // del template tendra una simple protecci&oacute;n contra spambots
?> ?>
]]> ]]>
</programlisting> </programlisting>

View File

@@ -29,12 +29,17 @@ function add_header_comment($tpl_source, &$smarty)
$smarty->register_postfilter("add_header_comment"); $smarty->register_postfilter("add_header_comment");
$smarty->display("index.tpl"); $smarty->display("index.tpl");
?> ?>
]]>
{* compiled Smarty template index.tpl *} </programlisting>
<para>
Observe como hacer la compilacion para Smarty del template index.tpl:
</para>
<screen>
<![CDATA[
<!-- Created by Smarty! --> <!-- Created by Smarty! -->
{* rest of template content... *} {* rest of template content... *}
]]> ]]>
</programlisting> </screen>
</example> </example>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -7,12 +7,16 @@
templates antes de ser compilados. Esto es bueno para procesar templates antes de ser compilados. Esto es bueno para procesar
por adelantado sus templates y remover comentarios no deseados, por adelantado sus templates y remover comentarios no deseados,
vigilando a las personas que coloquen en sus templates, etc. vigilando a las personas que coloquen en sus templates, etc.
</para>
<para>
Los Prefilters pueden ser Los Prefilters pueden ser
<link linkend="api.register.prefilter">registrado</link> <link linkend="api.register.prefilter">registrado</link>
o cargado del directorio de plugins usando la funci<63>n o cargado del directorio de plugins usando la funci<63>n
<link linkend="api.load.filter">load_filter()</link> o por la <link linkend="api.load.filter">load_filter()</link> o por la
configuraci<63>n de la variable configuraci<63>n de la variable
<link linkend="variable.autoload.filters">$autoload_filters</link>. <link linkend="variable.autoload.filters">$autoload_filters</link>.
</para>
<para>
El Smarty pasara el c<>digo fuente del template como el primer argumento, El Smarty pasara el c<>digo fuente del template como el primer argumento,
y espera que la funci<63>n le retorne el c<>digo fuente del template y espera que la funci<63>n le retorne el c<>digo fuente del template
resultante. resultante.
@@ -32,11 +36,11 @@ function remove_dw_comments($tpl_source, &$smarty)
$smarty->register_prefilter("remove_dw_comments"); $smarty->register_prefilter("remove_dw_comments");
$smarty->display("index.tpl"); $smarty->display("index.tpl");
?> ?>
{* Smarty template index.tpl *}
<!--# esta linea ser<65> eliminada por el prefilter -->
]]> ]]>
</programlisting> </programlisting>
<para>
Esto eliminara todos los comentarios en el codigo del template.
</para>
</example> </example>
</sect1> </sect1>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -3,10 +3,9 @@
<sect1 id="section.template.cache.handler.func"> <sect1 id="section.template.cache.handler.func">
<title>Funci<EFBFBD>n manipuladora de cache</title> <title>Funci<EFBFBD>n manipuladora de cache</title>
<para> <para>
Como una alternativa al uso del mecanismo de caching por default Como una alternativa al uso del mecanismo de caching por default basado
basado en archivo, usted puede especificar una funci<63>n habitual en archivo, usted puede especificar una funci<63>n habitual de manipulaci<63>n
de manipulaci<EFBFBD>n de cache que ser<65> usada para leer, escribir y de cache que ser<65> usada para leer, escribir y limpar archivos de cache.
limpar archivos de cache.
</para> </para>
<para> <para>
Cree una funci<63>n en su aplicaci<63>n para que Smarty la use como un Cree una funci<63>n en su aplicaci<63>n para que Smarty la use como un
@@ -83,9 +82,9 @@ function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=n
$row = mysql_fetch_array($results,MYSQL_ASSOC); $row = mysql_fetch_array($results,MYSQL_ASSOC);
if($use_gzip && function_exists("gzuncompress")) { if($use_gzip && function_exists("gzuncompress")) {
$cache_contents = gzuncompress($row["CacheContents"]); $cache_content = gzuncompress($row["CacheContents"]);
} else { } else {
$cache_contents = $row["CacheContents"]; $cache_content = $row["CacheContents"];
} }
$return = $results; $return = $results;
break; break;

View File

@@ -4,7 +4,9 @@
<title>Recursos</title> <title>Recursos</title>
<para> <para>
Los templates pueden venir de una variedad de fuentes. Cuando usted Los templates pueden venir de una variedad de fuentes. Cuando usted
muestra un template con (display) o (fetch), o incluye un template muestra un template con
<link linkend="api.display">display()</link> o
<link linkend="api.fetch">fetch()</link>, o incluye un template
dentro de otro template, usted suministra un tipo de recurso, seguido dentro de otro template, usted suministra un tipo de recurso, seguido
por la ruta correcta y el nombre del template. por la ruta correcta y el nombre del template.
Si un recurso no es dado explicitamente el valor de Si un recurso no es dado explicitamente el valor de
@@ -12,23 +14,24 @@
es asumido. es asumido.
</para> </para>
<sect2 id="templates.from.template.dir"> <sect2 id="templates.from.template.dir">
<title>Templates partiendo del $template_dir</title> <title>Templates desde $template_dir</title>
<para> <para>
Los templates desde el $template_dir no requieren recursos del Los templates desde el
template, aunque usted puede usar el file: resource for <link linkend="variable.template.dir">$template_dir</link> no requieren
recursos del template, aunque usted puede usar el file: resource for
consistancy(recurso por consistencia). Justamente proporcionando consistancy(recurso por consistencia). Justamente proporcionando
la ruta(path) del template que usted quiere usar en relaci<63>n al la ruta(path) del template que usted quiere usar en relaci<63>n al
directorio root $template_dir. directorio root <link linkend="variable.template.dir">$template_dir</link>.
</para> </para>
<example> <example>
<title>Usando templates partiendo del $template_dir</title> <title>Usando templates desde $template_dir</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
// desde el script de PHP // desde el script de PHP
$smarty->display("index.tpl"); $smarty->display("index.tpl");
$smarty->display("admin/menu.tpl"); $smarty->display("admin/menu.tpl");
$smarty->display("file:admin/menu.tpl"); // agual al de arriba $smarty->display("file:admin/menu.tpl"); // igual al de arriba
?> ?>
{* dentro del template de Smarty *} {* dentro del template de Smarty *}
@@ -41,12 +44,13 @@ $smarty->display("file:admin/menu.tpl"); // agual al de arriba
<sect2 id="templates.from.any.dir"> <sect2 id="templates.from.any.dir">
<title>Templates partiendo de cualquier directorio</title> <title>Templates partiendo de cualquier directorio</title>
<para> <para>
Los templates de fuera del $template_dir requieren el file: tipo Los templates de fuera del
de recurso del template, seguido por la ruta absoluta y el nombre <link linkend="variable.template.dir">$template_dir</link> requieren
del template. el file: tipo de recurso del template, seguido por la ruta absoluta
y el nombre del template.
</para> </para>
<example> <example>
<title>usando templates partiendo de cualquier directorio</title> <title>usando templates desde cualquier directorio</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -54,8 +58,13 @@ $smarty->display("file:admin/menu.tpl"); // agual al de arriba
$smarty->display("file:/export/templates/index.tpl"); $smarty->display("file:/export/templates/index.tpl");
$smarty->display("file:/path/to/my/templates/menu.tpl"); $smarty->display("file:/path/to/my/templates/menu.tpl");
?> ?>
]]>
{* desde adentro del template Smarty *} </programlisting>
<para>
dentro del template Smarty:
</para>
<programlisting>
<![CDATA[
{include file="file:/usr/local/share/templates/navigation.tpl"} {include file="file:/usr/local/share/templates/navigation.tpl"}
]]> ]]>
</programlisting> </programlisting>
@@ -79,8 +88,13 @@ $smarty->display("file:/path/to/my/templates/menu.tpl");
$smarty->display("file:C:/export/templates/index.tpl"); $smarty->display("file:C:/export/templates/index.tpl");
$smarty->display("file:F:/path/to/my/templates/menu.tpl"); $smarty->display("file:F:/path/to/my/templates/menu.tpl");
?> ?>
]]>
{* dentro del template de Smarty *} </programlisting>
<para>
dentro del template de Smarty
</para>
<programlisting>
<![CDATA[
{include file="file:D:/usr/local/share/templates/navigation.tpl"} {include file="file:D:/usr/local/share/templates/navigation.tpl"}
]]> ]]>
</programlisting> </programlisting>
@@ -118,7 +132,7 @@ $smarty->display("file:F:/path/to/my/templates/menu.tpl");
// ponga estas funciones en algun lugar de su aplicaci<63>n // ponga estas funciones en algun lugar de su aplicaci<63>n
function db_get_template ($tpl_name, &$tpl_source, &$smarty_obj) function db_get_template ($tpl_name, &$tpl_source, &$smarty_obj)
{ {
// ejecutar la base de datos madar llamar aqu<71> su template, // llame su base de datos parta traer los datos al template,
// poblando el $tpl_source // poblando el $tpl_source
$sql = new SQL; $sql = new SQL;
@@ -135,8 +149,7 @@ function db_get_template ($tpl_name, &$tpl_source, &$smarty_obj)
function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj) function db_get_timestamp($tpl_name, &$tpl_timestamp, &$smarty_obj)
{ {
// ejecutar la base de datos llamar aqu<71> para poblar // llame su base de datos para traer los datos y poblar el $tpl_timestamp.
// $tpl_timestamp.
$sql = new SQL; $sql = new SQL;
$sql->query("select tpl_timestamp $sql->query("select tpl_timestamp
from my_table from my_table
@@ -169,8 +182,13 @@ $smarty->register_resource("db", array("db_get_template",
// usando el recurso a partir del script PHP // usando el recurso a partir del script PHP
$smarty->display("db:index.tpl"); $smarty->display("db:index.tpl");
?> ?>
]]>
{* usando el recurso dentro del template de Smarty *} </programlisting>
<para>
usando el recurso dentro del template de Smarty
</para>
<programlisting>
<![CDATA[
{include file="db:/extras/navigation.tpl"} {include file="db:/extras/navigation.tpl"}
]]> ]]>
</programlisting> </programlisting>

View File

@@ -2,7 +2,7 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<!-- EN-Revision: 1.9 Maintainer: ramirez Status: ready --> <!-- EN-Revision: 1.9 Maintainer: ramirez Status: ready -->
<chapter id="api.functions"> <chapter id="api.functions">
<title>Metodos</title> <title>La clase Methods() de Smarty</title>
&programmers.api-functions.api-append; &programmers.api-functions.api-append;
&programmers.api-functions.api-append-by-ref; &programmers.api-functions.api-append-by-ref;
&programmers.api-functions.api-assign; &programmers.api-functions.api-assign;

View File

@@ -3,10 +3,10 @@
<refentry id="api.append.by.ref"> <refentry id="api.append.by.ref">
<refnamediv> <refnamediv>
<refname>append_by_ref</refname> <refname>append_by_ref</refname>
<refpurpose></refpurpose> <refpurpose>pasando valores por referencia</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descipci<EFBFBD>n</title>
<methodsynopsis> <methodsynopsis>
<type>void</type><methodname>append_by_ref</methodname> <type>void</type><methodname>append_by_ref</methodname>
<methodparam><type>string</type><parameter>varname</parameter></methodparam> <methodparam><type>string</type><parameter>varname</parameter></methodparam>
@@ -14,9 +14,10 @@
<methodparam choice="opt"><type>bool</type><parameter>merge</parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter>merge</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Este es usado para adicionar valores al templete por referencia. Este es usado para <link linkend="api.append">pasar</link> valores al
Si usted adiciona una variable por referencia entonces cambiara su valor, templete por referencia. Si usted pasa una variable por referencia entonces
el valor asignado sufrira el cambio tambi<62>n. Para objetos, append_by_ref() cambiara su valor, el valor asignado sufrira el cambio tambi<62>n. Para
<link linkend="advanced.features.objects">objetos</link>, append_by_ref()
tambi<62>n envia una copia en memoria del objeto adicionado. Vea el manual de tambi<62>n envia una copia en memoria del objeto adicionado. Vea el manual de
PHP en referenciando variables para una mejor explicaci<63>n del asunto. PHP en referenciando variables para una mejor explicaci<63>n del asunto.
Si usted pasa el tercer par<61>metro en true, el valor ser<65> mezclado con el Si usted pasa el tercer par<61>metro en true, el valor ser<65> mezclado con el
@@ -35,6 +36,11 @@ $smarty->append_by_ref("Address", $address);
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n <link linkend="api.append">append()</link>
y <link linkend="api.assign">assign()</link>.
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -2,11 +2,11 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.append"> <refentry id="api.append">
<refnamediv> <refnamediv>
<refname>append</refname> <refname>append()</refname>
<refpurpose></refpurpose> <refpurpose>agregando elementos a una matriz asignada</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descripci<EFBFBD>n</title>
<methodsynopsis> <methodsynopsis>
<type>void</type><methodname>append</methodname> <type>void</type><methodname>append</methodname>
<methodparam><type>mixed</type><parameter>var</parameter></methodparam> <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
@@ -37,11 +37,17 @@ $smarty->append("Name", "Fred");
$smarty->append("Address", $address); $smarty->append("Address", $address);
// passing an associative array // passing an associative array
$smarty->append(array("city" => "Lincoln", "state" => "Nebraska")); $smarty->append(array('city' => 'Lincoln', 'state' => 'Nebraska'));
?> ?>
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>Ver tambi<62>n
<link linkend="api.append.by.ref">append_by_ref()</link>,
<link linkend="api.assign">assign()</link>
y
<link linkend="api.get.template.vars">get_template_vars()</link>
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -3,19 +3,19 @@
<refentry id="api.assign.by.ref"> <refentry id="api.assign.by.ref">
<refnamediv> <refnamediv>
<refname>assign_by_ref</refname> <refname>assign_by_ref</refname>
<refpurpose></refpurpose> <refpurpose>pasando valores por referencia</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descripci<EFBFBD>n</title>
<methodsynopsis> <methodsynopsis>
<type>void</type><methodname>assign_by_ref</methodname> <type>void</type><methodname>assign_by_ref</methodname>
<methodparam><type>string</type><parameter>varname</parameter></methodparam> <methodparam><type>string</type><parameter>varname</parameter></methodparam>
<methodparam><type>mixed</type><parameter>var</parameter></methodparam> <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Este es usado para asignar valores por referencia al template en vez Este es usado para <link linkend="api.assign">asignar</link> valores por
de hacer una copia. Vea el manual de PHP en la parte sobre referencia referencia al template en vez de hacer una copia. Vea el manual de PHP en
de variables para una explicaci<63>n mas detallada. la parte sobre referencia de variables para una explicaci<63>n mas detallada.
</para> </para>
<note> <note>
<title>Nota T<>cnica</title> <title>Nota T<>cnica</title>
@@ -23,13 +23,13 @@
Este es usado para asignar valores por referencia al template. Este es usado para asignar valores por referencia al template.
Si ested asigna una variable por referencia entonces cambiara Si ested asigna una variable por referencia entonces cambiara
este valor, el valor asignado exprimentara el cambio tambi<62>n. este valor, el valor asignado exprimentara el cambio tambi<62>n.
Para objetos, assign_by_ref() tambi<62>n exite una copia del Para <link linkend="advanced.features.objects">objetos</link>,
objetos asignado en memoria. Vea el manual de PHP en refereciando assign_by_ref() tambi<62>n exite una copia del objetos asignado en memoria.
variables para una mejor explicaci<63>n. Vea el manual de PHP en refereciando variables para una mejor explicaci<63>n.
</para> </para>
</note> </note>
<example> <example>
<title>assign_by_ref</title> <title>assign_by_ref()</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -40,6 +40,13 @@ $smarty->assign_by_ref('Address', $address);
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n <link linkend="api.assign">assign()</link>,
<link linkend="api.clear.all.assign">clear_all_assign()</link>,
<link linkend="api.append">append()</link>
y <link linkend="language.function.assign">{assign}</link>
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -2,11 +2,11 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.assign"> <refentry id="api.assign">
<refnamediv> <refnamediv>
<refname>assign</refname> <refname>assign()</refname>
<refpurpose></refpurpose> <refpurpose>pasando valores para el template</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descripci<EFBFBD>n</title>
<methodsynopsis> <methodsynopsis>
<type>void</type><methodname>assign</methodname> <type>void</type><methodname>assign</methodname>
<methodparam><type>mixed</type><parameter>var</parameter></methodparam> <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
@@ -17,25 +17,57 @@
<methodparam><type>mixed</type><parameter>var</parameter></methodparam> <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Este es usado para asignar valores al template. Usted puede Usted puede explicitamente pasar pares de nombres/valores, o un arreglo
explicitamente pasar pares de nombres/valores, o un arreglo
asociativo conteniendo el par de nombre/valor. asociativo conteniendo el par de nombre/valor.
</para> </para>
<example> <example>
<title>assign</title> <title>assign()</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
// passing name/value pairs // pasando pares de nombre/valor
$smarty->assign('Name', 'Fred'); $smarty->assign('Name', 'Fred');
$smarty->assign('Address', $address); $smarty->assign('Address', $address);
// passing an associative array // pasando un arreglo asosiativo
$smarty->assign(array("city" => "Lincoln", "state" => "Nebraska")); $smarty->assign(array('city' => 'Lincoln', 'state' => 'Nebraska'));
// pasando un row desde una base de datos (eg adodb)
$sql = 'select id, name, email from contacts where contact ='.$id;
$smarty->assign('contact', $db->getRow($sql));
?>
]]>
</programlisting>
<para>
Accesando estos en el template con
</para>
<programlisting>
<![CDATA[
{$Name}
{$Address}
{$city}
{$state}
{$contact.id}, {$contact.name},{$contact.email}
?> ?>
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Para ver una asignacion de arreglos mas compleja
<link linkend="language.function.foreach">{foreach}</link>
y
<link linkend="language.function.section">{section}</link>
</para>
<para>
Vea tambi<62>n <link linkend="api.assign.by.ref">assign_by_ref()</link>,
<link linkend="api.get.template.vars">get_template_vars()</link>,
<link linkend="api.clear.assign">clear_assign()</link>,
<link linkend="api.append">append()</link>
y
<link linkend="language.function.assign">{assign}</link>
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -2,29 +2,43 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.clear.all.assign"> <refentry id="api.clear.all.assign">
<refnamediv> <refnamediv>
<refname>clear_all_assign</refname> <refname>clear_all_assign()</refname>
<refpurpose></refpurpose> <refpurpose>>limpia el valor de todas las variables asignadas</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descripci<EFBFBD>n</title>
<methodsynopsis> <methodsynopsis>
<type>void</type><methodname>clear_all_assign</methodname> <type>void</type><methodname>clear_all_assign</methodname>
<void /> <void />
</methodsynopsis> </methodsynopsis>
<para>
Esto limpia el valor de todas las variables asignadas.
</para>
<example> <example>
<title>clear_all_assign</title> <title>clear_all_assign()</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
// passing name/value pairs
$smarty->assign('Name', 'Fred');
$smarty->assign('Address', $address);
// will output above
print_r( $smarty->get_template_vars() );
// clear all assigned variables // clear all assigned variables
$smarty->clear_all_assign(); $smarty->clear_all_assign();
// will output nothing
print_r( $smarty->get_template_vars() );
?> ?>
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n
<link linkend="api.clear.assign">clear_assign()</link>,
<link linkend="api.clear.config">clear_config()</link>,
<link linkend="api.assign">assign()</link>
y <link linkend="api.append">append()</link>
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -3,7 +3,7 @@
<refentry id="api.clear.all.cache"> <refentry id="api.clear.all.cache">
<refnamediv> <refnamediv>
<refname>clear_all_cache</refname> <refname>clear_all_cache</refname>
<refpurpose></refpurpose> <refpurpose>limpia completamente el cache del template</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title />
@@ -12,9 +12,8 @@
<methodparam choice="opt"><type>int</type><parameter>expire_time</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>expire_time</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Esto limpia completamente el cache del template. Como un par<61>metro Como un par<61>metro opcional, usted puede proporcionar un periodo minimo
opcional, usted puede proporcionar un periodo minimo en segundos en segundos que el archivo de cache debe tener antes de ser anulado.
que el archivo de cache debe tener antes de ser anulado.
</para> </para>
<example> <example>
<title>clear_all_cache</title> <title>clear_all_cache</title>
@@ -27,6 +26,13 @@ $smarty->clear_all_cache();
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n
<link linkend="api.clear.cache">clear_cache()</link>,
<link linkend="api.is.cached">is_cached()</link>
y
<link linkend="caching">caching</link>
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -2,33 +2,40 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.clear.assign"> <refentry id="api.clear.assign">
<refnamediv> <refnamediv>
<refname>clear_assign</refname> <refname>clear_assign()</refname>
<refpurpose></refpurpose> <refpurpose>limpia el valor de una variable asignada</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title> Descripci<63>n</title>
<methodsynopsis> <methodsynopsis>
<type>void</type><methodname>clear_assign</methodname> <type>void</type><methodname>clear_assign</methodname>
<methodparam><type>mixed</type><parameter>var</parameter></methodparam> <methodparam><type>mixed</type><parameter>var</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Esto limpia el valor de una viariable asignada. Este puede ser un Este puede ser un valor simple, o un arreglo de valores.
valor simple, o un arreglo de valores.
</para> </para>
<example> <example>
<title>clear_assign</title> <title>clear_assign()</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
// clear a single variable // clear a single variable
$smarty->clear_assign("Name"); $smarty->clear_assign('Name');
// clear multiple variables // clear multiple variables
$smarty->clear_assign(array("Name", "Address", "Zip")); $smarty->clear_assign(array('Name', 'Address', 'Zip'));
?> ?>
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n
<link linkend="api.clear.all.assign">clear_all_assign()</link>,
<link linkend="api.clear.config">clear_config()</link>,
<link linkend="api.get.template.vars">get_template_vars()</link>,
<link linkend="api.assign">assign()</link>
y <link linkend="api.append">append()</link>
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -2,11 +2,11 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.clear.cache"> <refentry id="api.clear.cache">
<refnamediv> <refnamediv>
<refname>clear_cache</refname> <refname>clear_cache()</refname>
<refpurpose></refpurpose> <refpurpose>Esto limpia el cache de un template especifico</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descripci<EFBFBD>n</title>
<methodsynopsis> <methodsynopsis>
<type>void</type><methodname>clear_cache</methodname> <type>void</type><methodname>clear_cache</methodname>
<methodparam><type>string</type><parameter>template</parameter></methodparam> <methodparam><type>string</type><parameter>template</parameter></methodparam>
@@ -15,31 +15,36 @@
<methodparam choice="opt"><type>int</type><parameter>expire_time</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>expire_time</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Esto limpia el cahce de un <parameter>template</parameter> especifico. Si usted tiene <link linkend="caching.multiple.caches">multiples</link> caches
Si usted tiene multiples caches en este archivo, usted puede limpiar un en este archivo, usted puede limpiar un cache especifico proporcionando el
cache especifico proporcionando el <parameter>cache_id</parameter> como <parameter>cache_id</parameter> como segundo par<61>metro Usted tambi<62>n puede pasar
segundo par<EFBFBD>metro Usted tambi<62>n puede pasar el el <link linkend="variable.compile.id"><parameter>$compile_id</parameter></link>
<parameter>compile_id</parameter> como un tercer par<61>metro. como un tercer par<EFBFBD>metro. Usted puede <link linkend="caching.groups">"agrupar"</link>
Usted puede "agrupar" templates conjuntamente de esta manera estos pueden templates conjuntamente de esta manera estos pueden ser removidos como un grupo.
ser removidos como un grupo. Vea el Vea el <link linkend="caching">caching section</link> para mayor informaci<63>n.
<link linkend="caching">caching section</link> para mayor informaci<63>n.
Como un cuarto par<61>metro opcional, usted puede proporcionar un periodo Como un cuarto par<61>metro opcional, usted puede proporcionar un periodo
minimo en segundos que el archivo de cache debe tener antes de ser anulado. minimo en segundos que el archivo de cache debe tener antes de ser anulado.
</para> </para>
<example> <example>
<title>clear_cache</title> <title>clear_cache()</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
// clear the cache for a template // clear the cache for a template
$smarty->clear_cache("index.tpl"); $smarty->clear_cache('index.tpl');
// clear the cache for a particular cache id in an multiple-cache template // clear the cache for a particular cache id in an multiple-cache template
$smarty->clear_cache("index.tpl", "CACHEID"); $smarty->clear_cache('index.tpl', 'CACHEID');
?> ?>
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n
<link linkend="api.clear.all.cache">clear_all_cache()</link>
y
<link linkend="caching">caching</link>.
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -2,11 +2,11 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.clear.compiled.tpl"> <refentry id="api.clear.compiled.tpl">
<refnamediv> <refnamediv>
<refname>clear_compiled_tpl</refname> <refname>clear_compiled_tpl()</refname>
<refpurpose></refpurpose> <refpurpose>Esto limpia la vesion compilada del recurso de un template especifico</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descripci<EFBFBD>n</title>
<methodsynopsis> <methodsynopsis>
<type>void</type><methodname>clear_compiled_tpl</methodname> <type>void</type><methodname>clear_compiled_tpl</methodname>
<methodparam choice="opt"><type>string</type><parameter>tpl_file</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>tpl_file</parameter></methodparam>
@@ -16,14 +16,16 @@
<para> <para>
Esto limpia la versi<73>n compilada del recurso del template especificado, Esto limpia la versi<73>n compilada del recurso del template especificado,
o todos los archivos de templates compilados si no fueron especificados. o todos los archivos de templates compilados si no fueron especificados.
si usted lo pasa compile_is es limpiado. si usted lo pasa con ex_time, si usted pasa <link linkend="variable.compile.id">$compile_id</link> solo
entonces solo compilara los templates anteriores al exp_time segundo sera compilado este template especificado
seran limpiados, por default todos los templates son compilados y <link linkend="variable.compile.id">$compile_id</link> es limpiado.
limpiados independientemente de su tiempo de vida. Si usted lo pasa con ex_time, entonces solo compilara los templates
anteriores al exp_time segundo seran limpiados, por default todos los
templates son compilados y limpiados independientemente de su tiempo de vida.
Esta funci<63>n es solo para uso avanzado, normalmente no es necesaria. Esta funci<63>n es solo para uso avanzado, normalmente no es necesaria.
</para> </para>
<example> <example>
<title>clear_compiled_tpl</title> <title>clear_compiled_tpl()</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php

View File

@@ -2,22 +2,22 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.clear.config"> <refentry id="api.clear.config">
<refnamediv> <refnamediv>
<refname>clear_config</refname> <refname>clear_config()</refname>
<refpurpose></refpurpose> <refpurpose>Esto limpia todas las variables de configuraci<63>n</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descripci<EFBFBD>n</title>
<methodsynopsis> <methodsynopsis>
<type>void</type><methodname>clear_config</methodname> <type>void</type><methodname>clear_config</methodname>
<methodparam choice="opt"><type>string</type><parameter>var</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>var</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Esto limpia todas las variables de configuraci<EFBFBD>n asignadas. Esto limpia todas las variables de
Si es proporcionado el nombre de una variable, solamente esta <link linkend="language.config.variables">configuraci<EFBFBD>n asignadas</link>.
variable es limpiada. Si es proporcionado el nombre de una variable, solo esa variable es limpiada.
</para> </para>
<example> <example>
<title>clear_config</title> <title>clear_config()</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -30,6 +30,16 @@ $smarty->clear_config('foobar');
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n
<link linkend="api.get.config.vars">get_config_vars()</link>,
<link linkend="language.config.variables">config variables</link>,
<link linkend="config.files">config files</link>,
<link linkend="language.function.config.load">{config_load}</link>,
<link linkend="api.config.load">config_load()</link>
y
<link linkend="api.clear.assign">clear_assign()</link>
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -2,26 +2,27 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.config.load"> <refentry id="api.config.load">
<refnamediv> <refnamediv>
<refname>config_load</refname> <refname>config_load()</refname>
<refpurpose></refpurpose> <refpurpose>Carga el archivo de configuraci<63>n y lo asigna al template</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descripci<EFBFBD>n</title>
<methodsynopsis> <methodsynopsis>
<type>void</type><methodname>config_load</methodname> <type>void</type><methodname>config_load</methodname>
<methodparam><type>string</type><parameter>file</parameter></methodparam> <methodparam><type>string</type><parameter>file</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>section</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>section</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Esto carga el <parameter>archivo</parameter> de configuraci<63>n de Esto carga el <link linkend="config.files">archivo de configuraci<63>n</link> de
datos y lo asigna al template. Esto funciona id<69>ntico a la funci<63>n datos y lo asigna al template. Esto funciona id<69>ntico a la funci<63>n
<link linkend="language.function.config.load">config_load</link>. <link linkend="language.function.config.load">{config_load}</link>.
</para> </para>
<note> <note>
<title>Nota T<>cnica</title> <title>Nota T<>cnica</title>
<para> <para>
A partir de Smarty 2.4.0, las variables de template asignadas son A partir de Smarty 2.4.0, las variables de template asignadas son
mantenidas a trav<61>s de fetch() y display(). Las variables de mantenidas a trav<61>s de <link linkend="api.fetch">fetch()</link> y
<link linkend="api.display">display()</link>. Las variables de
configuraci<63>n cargadas de config_load() son siempre de alcance global. configuraci<63>n cargadas de config_load() son siempre de alcance global.
Los archivos de configuracion tambi<62>n son compilados para Los archivos de configuracion tambi<62>n son compilados para
execuci&oacute;n rapida, y respetar el execuci&oacute;n rapida, y respetar el
@@ -31,7 +32,7 @@
</para> </para>
</note> </note>
<example> <example>
<title>config_load</title> <title>config_load()</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -44,6 +45,14 @@ $smarty->config_load('my.conf', 'foobar');
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n
<link linkend="language.function.config.load">{config_load}</link>,
<link linkend="api.get.config.vars">get_config_vars()</link>,
<link linkend="api.clear.config">clear_config()</link>,
y
<link linkend="language.config.variables">config variables</link>
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -2,11 +2,11 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.display"> <refentry id="api.display">
<refnamediv> <refnamediv>
<refname>display</refname> <refname>display()</refname>
<refpurpose></refpurpose> <refpurpose>Despliega el Template</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descripci<EFBFBD>n </title>
<methodsynopsis> <methodsynopsis>
<type>void</type><methodname>display</methodname> <type>void</type><methodname>display</methodname>
<methodparam><type>string</type><parameter>template</parameter></methodparam> <methodparam><type>string</type><parameter>template</parameter></methodparam>
@@ -14,7 +14,8 @@
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Este despliega el template. cargando un tipo valido de path Este despliega el template diferente de <link
linkend="api.fetch">fetch()</link>. Cargando un tipo valido de path
<link linkend="template.resources">template resource</link>. <link linkend="template.resources">template resource</link>.
Como un segundo par<61>metro opcional, usted puede pasar un Como un segundo par<61>metro opcional, usted puede pasar un
identificador de cache. identificador de cache.
@@ -23,7 +24,7 @@
</para> </para>
&parameter.compileid; &parameter.compileid;
<example> <example>
<title>display</title> <title>display()</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -56,7 +57,8 @@ $smarty->display("index.tpl");
</example> </example>
<para> <para>
Use la sintaxis <link linkend="template.resources">template resources</link> Use la sintaxis <link linkend="template.resources">template resources</link>
para mostrar archivos fuera del directorio $template_dir. para mostrar archivos fuera del directorio
<link linkend="variable.template.dir">$template_dir</link>.
</para> </para>
<example> <example>
<title>Ejemplos de recursos de la funci<63>n display</title> <title>Ejemplos de recursos de la funci<63>n display</title>
@@ -64,20 +66,24 @@ $smarty->display("index.tpl");
<![CDATA[ <![CDATA[
<?php <?php
// absolute filepath // absolute filepath
$smarty->display("/usr/local/include/templates/header.tpl"); $smarty->display('/usr/local/include/templates/header.tpl');
// absolute filepath (same thing) // absolute filepath (same thing)
$smarty->display("file:/usr/local/include/templates/header.tpl"); $smarty->display('file:/usr/local/include/templates/header.tpl');
// windows absolute filepath (MUST use "file:" prefix) // windows absolute filepath (MUST use "file:" prefix)
$smarty->display("file:C:/www/pub/templates/header.tpl"); $smarty->display('file:C:/www/pub/templates/header.tpl');
// include from template resource named "db" // include from template resource named "db"
$smarty->display("db:header.tpl"); $smarty->display('db:header.tpl');
?> ?>
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n <link linkend="api.fetch">fetch()</link> y
<link linkend="api.template.exists">template_exists()</link>.
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -2,19 +2,20 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.fetch"> <refentry id="api.fetch">
<refnamediv> <refnamediv>
<refname>fetch</refname> <refname>fetch()</refname>
<refpurpose></refpurpose> <refpurpose>Retorna la salida del template</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descripci<EFBFBD>n</title>
<methodsynopsis> <methodsynopsis>
<type>string</type><methodname>fetch</methodname> <type>string</type><methodname>fetch</methodname>
<methodparam><type>string</type><parameter>template</parameter></methodparam> <methodparam><type>string</type><parameter>template</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>cache_id</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>cache_id</parameter></methodparam>
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>$compile_id</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Este retorna la salida del template en vez de desplegarla. Este retorna la salida del template en vez de
<link linkend="api.display">desplegarla</link>.
Proporcionando un tipo y path valido Proporcionando un tipo y path valido
<link linkend="template.resources">template resource</link>. <link linkend="template.resources">template resource</link>.
Como un segundo par<61>metro opcional, usted puede pasar el Como un segundo par<61>metro opcional, usted puede pasar el
@@ -23,36 +24,37 @@
mayor informaci<63>n. mayor informaci<63>n.
</para> </para>
&parameter.compileid; &parameter.compileid;
<para> <para>
<example> <example>
<title>fetch</title> <title>fetch()</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
include("Smarty.class.php"); include('Smarty.class.php');
$smarty = new Smarty; $smarty = new Smarty;
$smarty->caching = true; $smarty->caching = true;
// only do db calls if cache doesn't exist // only do db calls if cache doesn't exist
if(!$smarty->is_cached("index.tpl")) { if(!$smarty->is_cached('index.tpl')) {
// dummy up some data // dummy up some data
$address = "245 N 50th"; $address = '245 N 50th';
$db_data = array( $db_data = array(
"City" => "Lincoln", 'City' => 'Lincoln',
"State" => "Nebraska", 'State' => 'Nebraska',
"Zip" => "68502" 'Zip' => '68502'
); );
$smarty->assign("Name","Fred"); $smarty->assign('Name','Fred');
$smarty->assign("Address",$address); $smarty->assign('Address',$address);
$smarty->assign($db_data); $smarty->assign($db_data);
} }
// capture the output // capture the output
$output = $smarty->fetch("index.tpl"); $output = $smarty->fetch('index.tpl');
// do something with $output here // do something with $output here
@@ -62,8 +64,75 @@ echo $output;
</programlisting> </programlisting>
</example> </example>
</para> </para>
<para>
<example>
<title>Usando fetch() y enviando a un e-mail</title>
<para>
El template email_body.tpl
</para>
<programlisting>
<![CDATA[
Dear {$contact.name},
Welcome and thankyou for signing up as a member of our user group,
Click on the link below to login with your user name of '{$contact.login_id}'
so you can post in our forums.
http://{$smarty.server.SERVER_NAME}/index.php?page=login
List master
Some user group
{include file="email_disclaimer.tpl"}
]]>
</programlisting>
<para>
El template email_disclaimer.tpl usando el modificador
<link linkend="language.function.textformat">{textformat}</link>.
</para>
<programlisting>
<![CDATA[
{textformat wrap=40}
Unless you are named "{$contact.name}", you may read only the "odd numbered
words" (every other word beginning with the first) of the message above. If you have
violated that, then you hereby owe the sender 10 GBP for each even
numbered word you have read
{/textformat}
]]>
</programlisting>
<para>
y el script de PHP usando la funci<63>n
<ulink url="&url.php-manual;function.mail">mail()</ulink>
</para>
<programlisting role="php">
<![CDATA[
<?php
// get contact from database eg using pear or adodb
$query = 'select name, email, login_id from contacts where contact_id='.$contact_id;
$contact = $db->getRow($sql);
$smarty->assign('contact', $contact);
mail($contact['email'], 'Subject', $smarty->fetch('email_body.tpl'));
?>
]]>
</programlisting>
</example>
</para>
<para>
Ver tambi<62>n
<link linkend="language.function.fetch">{fetch}</link>
<link linkend="api.display">display()</link>,
<link linkend="language.function.eval">{eval}</link>,
y
<link linkend="api.template.exists">template_exists()</link>.
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file
Local variables: Local variables:
mode: sgml mode: sgml

View File

@@ -2,22 +2,22 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.get.config.vars"> <refentry id="api.get.config.vars">
<refnamediv> <refnamediv>
<refname>get_config_vars</refname> <refname>get_config_vars()</refname>
<refpurpose></refpurpose> <refpurpose>retorna el valor asignado a la variable de configuraci<63>n</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descripci<EFBFBD>n</title>
<methodsynopsis> <methodsynopsis>
<type>array</type><methodname>get_config_vars</methodname> <type>array</type><methodname>get_config_vars</methodname>
<methodparam choice="opt"><type>string</type><parameter>varname</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>varname</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Este retona el valor de la variable de configuraci<63>n dado. Si no tiene un par<61>metro asignado, un arreglo de todas las
Si no tiene un par<61>metro dado, un arreglo de todas las variables <link linkend="language.config.variables">variables
de los archivos de configuraci<63>n es retornado. de los archivos de configuraci<63>n</link> es retornado.
</para> </para>
<example> <example>
<title>get_config_vars</title> <title>get_config_vars()</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -33,6 +33,14 @@ print_r($config_vars);
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n
<link linkend="api.clear.config">clear_config()</link>,
<link linkend="language.function.config.load">{config_load}</link>,
<link linkend="api.config.load">config_load()</link>
y
<link linkend="api.get.template.vars">get_template_vars()</link>.
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -2,22 +2,24 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.get.registered.object"> <refentry id="api.get.registered.object">
<refnamediv> <refnamediv>
<refname>get_registered_object</refname> <refname>get_registered_object()</refname>
<refpurpose></refpurpose> <refpurpose>Este retorna una referencia para un objeto registrado.</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descripci<EFBFBD>n</title>
<methodsynopsis> <methodsynopsis>
<type>array</type><methodname>get_registered_object</methodname> <type>array</type><methodname>get_registered_object</methodname>
<methodparam><type>string</type><parameter>object_name</parameter></methodparam> <methodparam><type>string</type><parameter>object_name</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Este retorna una referencia para un objeto registrado.
Este es <20>til dentro de una funci<63>n habitual cuando usted Este es <20>til dentro de una funci<63>n habitual cuando usted
necesita acesar directamente a un objeto registrado. necesita acesar directamente a un
<link linkend="api.register.object">objeto registrado</link>.
Ver <link linkend="advanced.features.objects">objects</link> para mas
informaci<63>n;
</para> </para>
<example> <example>
<title>get_registered_object</title> <title>get_registered_object()</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -33,6 +35,13 @@ function smarty_block_foo($params, &$smarty)
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n
<link linkend="api.register.object">register_object()</link>,
<link linkend="api.unregister.object">unregister_object()</link>
y
<link linkend="advanced.features.objects">objects section</link>
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -2,19 +2,18 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.get.template.vars"> <refentry id="api.get.template.vars">
<refnamediv> <refnamediv>
<refname>get_template_vars</refname> <refname>get_template_vars()</refname>
<refpurpose></refpurpose> <refpurpose>Retorna el valor asignado a una variable</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>descripci<EFBFBD>n</title>
<methodsynopsis> <methodsynopsis>
<type>array</type><methodname>get_template_vars</methodname> <type>array</type><methodname>get_template_vars</methodname>
<methodparam choice="opt"><type>string</type><parameter>varname</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>varname</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Este retorna el valor de una variable asignada. Si no tiene un Si no tiene un par<61>metro dado, un arreglo de todas las variables
par<EFBFBD>metro dado, un arreglo de todas las variables asignadas es <link linkend="api.assign">asignadas</link> es retornado.
retornado.
</para> </para>
<example> <example>
<title>get_template_vars</title> <title>get_template_vars</title>
@@ -33,6 +32,17 @@ print_r($tpl_vars);
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n <link linkend="api.assign">assign()</link>,
<link linkend="language.function.assign">{assign}</link>,
<link linkend="api.assign.by.ref">assign_by_ref()</link>,
<link linkend="api.append">append()</link>,
<link linkend="api.clear.assign">clear_assign()</link>,
<link linkend="api.clear.all.assign">clear_all_assign()</link>
y
<link linkend="api.get.config.vars">get_config_vars()</link>
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -2,11 +2,11 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.is.cached"> <refentry id="api.is.cached">
<refnamediv> <refnamediv>
<refname>is_cached</refname> <refname>is_cached()</refname>
<refpurpose></refpurpose> <refpurpose>Retorna true si hay cache valido para ese template</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descripci<EFBFBD>n </title>
<methodsynopsis> <methodsynopsis>
<type>bool</type><methodname>is_cached</methodname> <type>bool</type><methodname>is_cached</methodname>
<methodparam><type>string</type><parameter>template</parameter></methodparam> <methodparam><type>string</type><parameter>template</parameter></methodparam>
@@ -14,12 +14,12 @@
<methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>compile_id</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Este retorna true si hay un cache valido para ese template.
Esto solamente funciona si <link linkend="variable.caching"> Esto solamente funciona si <link linkend="variable.caching">
caching</link> est<73> asignado a true. caching</link> est<73> asignado a true.
ver tambi<62>n <link linkend="caching">caching section</link>.
</para> </para>
<example> <example>
<title>is_cached</title> <title>is_cached()</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -35,9 +35,10 @@ $smarty->display("index.tpl");
</programlisting> </programlisting>
</example> </example>
<para> <para>
Usted tambi<62>n puede pasar un identificador de cache como un Usted tambi<62>n puede pasar un identificador de $cache como un
segundo par<61>metro opcional en el caso que usted quiera multiples segundo par<61>metro opcional en el caso que usted quiera
caches para el template dado. <link linkend="caching.multiple.caches">multiples caches</link>
para el template dado.
</para> </para>
<para> <para>
Usted puede proporcionar el identidicador como un tercer parametro Usted puede proporcionar el identidicador como un tercer parametro
@@ -45,12 +46,13 @@ $smarty->display("index.tpl");
<link linkend="variable.compile.id">$compile_id</link> es usada. <link linkend="variable.compile.id">$compile_id</link> es usada.
</para> </para>
<para> <para>
Si usted no quiere pasar el identificador de cache solamente Si usted no quiere pasar el
quiere pasar el compile id debe pasar <literal>null</literal> <link linkend="variable.compile.id">identificador de cache</link>
solamente quiere pasar el compile id debe pasar <literal>null</literal>
como el identidficador de cache. como el identidficador de cache.
</para> </para>
<example> <example>
<title>is_cached con templates con multiple-cache</title> <title>is_cached() con templates con multiple-cache</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
@@ -83,6 +85,14 @@ $smarty->display("index.tpl", "FrontPage");
<literal>is_cached</literal> retorna true. <literal>is_cached</literal> retorna true.
</para> </para>
</note> </note>
<para>
Ver tambi<62>n
<link linkend="api.clear.cache">clear_cache()</link>,
<link linkend="api.clear.all.cache">clear_all_cache()</link>,
y
<link linkend="caching">caching section</link>.
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -2,18 +2,17 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.load.filter"> <refentry id="api.load.filter">
<refnamediv> <refnamediv>
<refname>load_filter</refname> <refname>load_filter()</refname>
<refpurpose></refpurpose> <refpurpose>Carga un filtro de plugin</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title> Descripci<63>n</title>
<methodsynopsis> <methodsynopsis>
<type>void</type><methodname>load_filter</methodname> <type>void</type><methodname>load_filter</methodname>
<methodparam><type>string</type><parameter>type</parameter></methodparam> <methodparam><type>string</type><parameter>type</parameter></methodparam>
<methodparam><type>string</type><parameter>name</parameter></methodparam> <methodparam><type>string</type><parameter>name</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Esta funci<63>n puede ser usada para cargar un filtro de plugin.
El primer argumento especif<69>ca el tipo de filtro a cargar y puede El primer argumento especif<69>ca el tipo de filtro a cargar y puede
ser uno de los siguientes: 'pre', 'post', o 'output'. El segundo ser uno de los siguientes: 'pre', 'post', o 'output'. El segundo
argumento especif<69>ca el nombre del filtro del plugin, por ejemplo, argumento especif<69>ca el nombre del filtro del plugin, por ejemplo,
@@ -31,6 +30,16 @@ $smarty->load_filter('output', 'compress'); // load output filter named 'compres
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n
<link linkend="api.register.prefilter">register_prefilter()</link>,
<link linkend="api.register.postfilter">register_postfilter()</link>,
<link linkend="api.register.outputfilter">register_outputfilter()</link>,
<link linkend="variable.autoload.filters">$autoload_filters</link>
y
<link linkend="advanced.features">Advanced features</link>.
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -2,11 +2,11 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.register.block"> <refentry id="api.register.block">
<refnamediv> <refnamediv>
<refname>register_block</refname> <refname>register_block()</refname>
<refpurpose></refpurpose> <refpurpose>Registra dinamicamente bloques de funciones de plugins </refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descripci<EFBFBD>n</title>
<methodsynopsis> <methodsynopsis>
<type>void</type><methodname>register_block</methodname> <type>void</type><methodname>register_block</methodname>
<methodparam><type>string</type><parameter>name</parameter></methodparam> <methodparam><type>string</type><parameter>name</parameter></methodparam>
@@ -38,11 +38,11 @@
plugins </link> para saber como usar las propiedades. plugins </link> para saber como usar las propiedades.
</para> </para>
<example> <example>
<title>register_block</title> <title>register_block()</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
$smarty->register_block("translate", "do_translation"); $smarty->register_block('translate', 'do_translation');
function do_translation ($params, $content, &$smarty, &$repeat) function do_translation ($params, $content, &$smarty, &$repeat)
{ {
@@ -67,6 +67,13 @@ Hello, world!
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n
<link linkend="api.unregister.block">unregister_block()</link>
y
<link linkend="plugins.block.functions">Plugin Block Functions</link>.
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -3,10 +3,10 @@
<refentry id="api.register.compiler.function"> <refentry id="api.register.compiler.function">
<refnamediv> <refnamediv>
<refname>register_compiler_function</refname> <refname>register_compiler_function</refname>
<refpurpose></refpurpose> <refpurpose>Registra dinamicamente un plugin de una funcion compiladora</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descripci<EFBFBD>n </title>
<methodsynopsis> <methodsynopsis>
<type>bool</type><methodname>register_compiler_function</methodname> <type>bool</type><methodname>register_compiler_function</methodname>
<methodparam><type>string</type><parameter>name</parameter></methodparam> <methodparam><type>string</type><parameter>name</parameter></methodparam>
@@ -14,29 +14,41 @@
<methodparam><type>bool</type><parameter>cacheable</parameter></methodparam> <methodparam><type>bool</type><parameter>cacheable</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Use esto para registrar din<69>micamente una funci<63>n compiladora Pase el nombre de la
de plugin. Pase el nombre de la funci<EFBFBD>n compiladora, seguido <link linkend="plugins.compiler.functions">funci<EFBFBD>n compiladora</link>,
por la funci<63>n PHP que implemente esto. seguido por la funci<63>n PHP que implemente esto.
</para> </para>
<para> <para>
La llamada a la funcion-php <parameter>impl</parameter> puede ser La llamada a la funcion-php <parameter>impl</parameter> puede ser
(a) una cadena conteniendo el nombre de la funci<63>n o
(b) un arreglo en el formato
<literal>array(&amp;$object, $method)</literal> con
<literal>&amp;$object</literal> siendo una referencia para
un objeto y <literal>$method</literal> siendo una cadena conteniendo
el nombre del m<>todo o
(c) un arreglo en el formato
<literal>array(&amp;$class, $method)</literal> con
<literal>$class</literal> siendo un nombre de
clase y <literal>$method</literal> siendo el m<>todo de esta clase.
</para> </para>
<orderedlist numeration="loweralpha">
<listitem>
<para> <para>
<parameter>cacheable</parameter> puede ser omitido en la mayoria a una cadena conteniendo el nombre de la funci<63>n
de los casos. </para>
</listitem><listitem>
<para>un arreglo con la forma <literal>array(&amp;$object, $method)</literal> con
<literal>&amp;$object</literal> siendo una referencia para un objeto y
<literal>$method</literal> siendo una cadena conteniendo el nombre del m<>todo
</para>
</listitem><listitem>
<para>un arreglo con la forma
<literal>array(&amp;$class, $method)</literal> con
<literal>$class</literal> siendo el nombre de una clase y
<literal>$method</literal> siendo el m<>todo de esta clase.
</para>
</listitem>
</orderedlist>
<para>
<parameter>cacheable</parameter> puede ser omitido en la mayoria de los casos.
Vea <link linkend="caching.cacheable">Controlando modos de Salida de Vea <link linkend="caching.cacheable">Controlando modos de Salida de
Cache de los Plugins</link> para obtener mayor informaci<63>n. Cache de los Plugins</link> para obtener mayor informaci<63>n.
</para> </para>
<para>
Ver tambi<62>n <link linkend="api.unregister.compiler.function">unregister_compiler_function() </link>
y <link linkend="plugins.compiler.functions">Plugin Compiler Functions</link>.
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

View File

@@ -2,50 +2,60 @@
<!-- $Revision$ --> <!-- $Revision$ -->
<refentry id="api.register.function"> <refentry id="api.register.function">
<refnamediv> <refnamediv>
<refname>register_function</refname> <refname>register_function()</refname>
<refpurpose></refpurpose> <refpurpose>Registra dinamicamente un plugin de funci<63>n para un template</refpurpose>
</refnamediv> </refnamediv>
<refsect1> <refsect1>
<title /> <title>Descripci<EFBFBD>n</title>
<methodsynopsis> <methodsynopsis>
<type>void</type><methodname>register_function</methodname> <type>void</type><methodname>register_function</methodname>
<methodparam><type>string</type><parameter>name</parameter></methodparam> <methodparam><type>string</type><parameter>name</parameter></methodparam>
<methodparam><type>mixed</type><parameter>impl</parameter></methodparam> <methodparam><type>mixed</type><parameter>impl</parameter></methodparam>
<methodparam><type>bool</type><parameter>cacheable</parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter>cacheable</parameter></methodparam>
<methodparam><type>mixed</type><parameter>cache_attrs</parameter></methodparam> <methodparam choice="opt"><type>mixed</type><parameter>cache_attrs</parameter></methodparam>
</methodsynopsis> </methodsynopsis>
<para> <para>
Use este para registrar funciones de plugins din<69>micamente para Pase en el template el nombre de la funci<63>n, seguido
el template. Pase en el template el nombre de la funci<63>n, seguido
por el nombre de la funci<63>n PHP que implementa esto. por el nombre de la funci<63>n PHP que implementa esto.
</para> </para>
<para> <para>
La llamada a la funcion-php <parameter>impl</parameter> puede ser La llamada a la funcion-php <parameter>impl</parameter> puede ser:
(a) una cadena conteniendo el nombre de la funci<63>n o
(b) un arreglo en el formato
<literal>array(&amp;$object, $method)</literal> con
<literal>&amp;$object</literal> siendo una referencia para
un objeto y <literal>$method</literal> siendo una cadena
conteniendo el nombre del m<>todo o
(c) un arreglo en el formato
<literal>array(&amp;$class, $method)</literal> con
<literal>$class</literal> siendo un nombre de clase y
<literal>$method</literal> siendo un m<>todo de esta clase.
</para> </para>
<orderedlist numeration="loweralpha">
<listitem>
<para> <para>
<parameter>cacheable</parameter> y <parameter>cache_attrs</parameter> a una cadena conteniendo el nombre de la funci<63>n o
pueden ser omitidos en la mayoria de los casos. </para>
</listitem><listitem>
<para>
un arreglo con la forma
<literal>array(&amp;$object, $method)</literal> con
<literal>&amp;$object</literal> siendo una referencia para un objeto y
<literal>$method</literal> siendo una cadena conteniendo el nombre del m<>todo
</para>
</listitem><listitem>
<para>
un arreglo con la forma <literal>array(&amp;$class, $method)</literal>
con <literal>$class</literal> siendo el nombre de una clase y
<literal>$method</literal> siendo un metodo de esa clase.
</para>
</listitem>
</orderedlist>
<para>
<parameter>cacheable</parameter> y <parameter>cache_attrs</parameter> pueden ser omitidos
en la mayoria de los caasos.
Vea <link linkend="caching.cacheable">Controlando modos de Salida Cache de Vea <link linkend="caching.cacheable">Controlando modos de Salida Cache de
los Plugins</link> para obtener mayores informes. los Plugins</link> para obtener mayores informes.
</para> </para>
<example> <example>
<title>register_function</title> <title>register_function()</title>
<programlisting role="php"> <programlisting role="php">
<![CDATA[ <![CDATA[
<?php <?php
$smarty->register_function("date_now", "print_current_date"); $smarty->register_function('date_now', 'print_current_date');
function print_current_date($params) function print_current_date($params, &$smarty)
{ {
if(empty($params['format'])) { if(empty($params['format'])) {
$format = "%b %e, %Y"; $format = "%b %e, %Y";
@@ -54,12 +64,27 @@ function print_current_date($params)
return strftime($format,time()); return strftime($format,time());
} }
} }
// ahora usted puede usar eso en el Smarty para mostrar la fecha actual:
// {date_now} o, {date_now format="%Y/%m/%d"} para formatearle.
?> ?>
]]>
</programlisting>
<para>
y en el template
</para>
<programlisting>
<![CDATA[
{date_now}
{* or to format differently *}
{date_now format="%Y/%m/%d"}
]]> ]]>
</programlisting> </programlisting>
</example> </example>
<para>
Ver tambi<62>n <link linkend="api.unregister.function">unregister_function()</link>
y <link linkend="plugins.functions">Plugin functions</link>.
</para>
</refsect1> </refsect1>
</refentry> </refentry>
<!-- Keep this comment at the end of the file <!-- Keep this comment at the end of the file

Some files were not shown because too many files have changed in this diff Show More