mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-05 06:41:39 +01:00
153 lines
5.9 KiB
XML
153 lines
5.9 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 1.2 Maintainer: thomasgm Status: ready -->
|
|
<sect1 id="language.function.html.table">
|
|
<title>html_table</title>
|
|
<informaltable frame="all">
|
|
<tgroup cols="5">
|
|
<colspec colname="param" align="center" />
|
|
<colspec colname="type" align="center" />
|
|
<colspec colname="required" align="center" />
|
|
<colspec colname="default" align="center" />
|
|
<colspec colname="desc" />
|
|
<thead>
|
|
<row>
|
|
<entry>Nome do atributo</entry>
|
|
<entry>Tipo</entry>
|
|
<entry>Obrigatório</entry>
|
|
<entry>Padrão</entry>
|
|
<entry>Descrição</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>loop</entry>
|
|
<entry>array</entry>
|
|
<entry>Sim</entry>
|
|
<entry><emphasis>n/d</emphasis></entry>
|
|
<entry>array de dados para ser feito o loop</entry>
|
|
</row>
|
|
<row>
|
|
<entry>cols</entry>
|
|
<entry>inteiro</entry>
|
|
<entry>Não</entry>
|
|
<entry><emphasis>3</emphasis></entry>
|
|
<entry>número de colunas na tabela</entry>
|
|
</row>
|
|
<row>
|
|
<entry>table_attr</entry>
|
|
<entry>string</entry>
|
|
<entry>Não</entry>
|
|
<entry><emphasis>border="1"</emphasis></entry>
|
|
<entry>atributos para a tag table</entry>
|
|
</row>
|
|
<row>
|
|
<entry>tr_attr</entry>
|
|
<entry>string</entry>
|
|
<entry>Não</entry>
|
|
<entry><emphasis>empty</emphasis></entry>
|
|
<entry>atributos para a tag tr (arrays estão em ciclo)</entry>
|
|
</row>
|
|
<row>
|
|
<entry>td_attr</entry>
|
|
<entry>string</entry>
|
|
<entry>Não</entry>
|
|
<entry><emphasis>empty</emphasis></entry>
|
|
<entry>atributos para a tag (arrays estão em ciclo)</entry>
|
|
</row>
|
|
<row>
|
|
<entry>trailpad</entry>
|
|
<entry>string</entry>
|
|
<entry>Não</entry>
|
|
<entry><emphasis>&nbsp;</emphasis></entry>
|
|
<entry>values to pad the trailing cells on last row with
|
|
(se algum)</entry>
|
|
</row>
|
|
|
|
<row>
|
|
<entry>hdir</entry>
|
|
<entry>string</entry>
|
|
<entry>Não</entry>
|
|
<entry><emphasis>right</emphasis></entry>
|
|
<entry>direçao de uma linha para ser representada. Possíveis valores: <emphasis>left</emphasis>/<emphasis>right</emphasis></entry>
|
|
</row>
|
|
<row>
|
|
<entry>vdir</entry>
|
|
<entry>string</entry>
|
|
<entry>Não</entry>
|
|
<entry><emphasis>down</emphasis></entry>
|
|
<entry>direção das colunas para serem representadas. Possíveis valores: <emphasis>up</emphasis>/<emphasis>down</emphasis></entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
<para>
|
|
<emphasis>html_table</emphasis> é uma função personalizada que transforma um array de dados
|
|
em uma tabela HTML. O atributo <emphasis>cols</emphasis> determina a quantidade de colunas que
|
|
a tabela terá. Os valores <emphasis>table_attr</emphasis>, <emphasis>tr_attr</emphasis> e
|
|
<emphasis>td_attr</emphasis> determinam os atributos dados para a tabela, tags tr e td. Se <emphasis>tr_attr</emphasis> ou
|
|
<emphasis>td_attr</emphasis> são arrays, eles entrarão em ciclo.
|
|
<emphasis>trailpad</emphasis> é o
|
|
valor colocado dentro do trailing
|
|
cells na última linha da tabela
|
|
se há alguma presente.
|
|
</para>
|
|
<example>
|
|
<title>html_table</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
index.php:
|
|
|
|
require('Smarty.class.php');
|
|
$smarty = new Smarty;
|
|
$smarty->assign('data',array(1,2,3,4,5,6,7,8,9));
|
|
$smarty->assign('tr',array('bgcolor="#eeeeee"','bgcolor="#dddddd"'));
|
|
$smarty->display('index.tpl');
|
|
|
|
index.tpl:
|
|
|
|
{html_table loop=$data}
|
|
{html_table loop=$data cols=4 table_attr='border="0"'}
|
|
{html_table loop=$data cols=4 tr_attr=$tr}
|
|
|
|
MOSTRA:
|
|
|
|
<table border="1">
|
|
<tr><td>1</td><td>2</td><td>3</td></tr>
|
|
<tr><td>4</td><td>5</td><td>6</td></tr>
|
|
<tr><td>7</td><td>8</td><td>9</td></tr>
|
|
</table>
|
|
<table border="0">
|
|
<tr><td>1</td><td>2</td><td>3</td><td>4</td></tr>
|
|
<tr><td>5</td><td>6</td><td>7</td><td>8</td></tr>
|
|
<tr><td>9</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
|
|
</table>
|
|
<table border="1">
|
|
<tr bgcolor="#eeeeee"><td>1</td><td>2</td><td>3</td><td>4</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>
|
|
</table>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</sect1>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
--> |