mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-03 05:41:37 +01:00
huge sync with english by the translator (Mario Ramirez)
thanks
This commit is contained in:
@@ -2,11 +2,11 @@
|
||||
<!-- $Revision$ -->
|
||||
<refentry id="api.assign">
|
||||
<refnamediv>
|
||||
<refname>assign</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>assign()</refname>
|
||||
<refpurpose>pasando valores para el template</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Descripci<EFBFBD>n</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>assign</methodname>
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
@@ -17,25 +17,57 @@
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Este es usado para asignar valores al template. Usted puede
|
||||
explicitamente pasar pares de nombres/valores, o un arreglo
|
||||
Usted puede explicitamente pasar pares de nombres/valores, o un arreglo
|
||||
asociativo conteniendo el par de nombre/valor.
|
||||
</para>
|
||||
<example>
|
||||
<title>assign</title>
|
||||
<programlisting role="php">
|
||||
<title>assign()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
// passing name/value pairs
|
||||
// pasando pares de nombre/valor
|
||||
$smarty->assign('Name', 'Fred');
|
||||
$smarty->assign('Address', $address);
|
||||
|
||||
// passing an associative array
|
||||
$smarty->assign(array("city" => "Lincoln", "state" => "Nebraska"));
|
||||
// pasando un arreglo asosiativo
|
||||
$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>
|
||||
</programlisting>
|
||||
<para>
|
||||
Accesando estos en el template con
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{$Name}
|
||||
{$Address}
|
||||
{$city}
|
||||
{$state}
|
||||
|
||||
{$contact.id}, {$contact.name},{$contact.email}
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</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>
|
||||
</refentry>
|
||||
<!-- Keep this comment at the end of the file
|
||||
|
||||
Reference in New Issue
Block a user