#the sync tag is just for translation
This commit is contained in:
nlopess
2004-09-29 16:07:23 +00:00
parent 68b9065b6a
commit ea0842b9c8

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="iso-8859-1"?> <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ --> <!-- $Revision$ -->
<!-- EN-Revision: 1.4 Maintainer: messju Status: ready --> <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">
@@ -32,24 +31,38 @@
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>3</emphasis></entry> <entry><emphasis>3</emphasis></entry>
<entry>number of columns in the table. if the cols-attribute is empty, but rows are given, then the number of cols is computed by the number of rows and the number of elements to display to be just enough cols to display all elements. If both, rows and cols, are omitted cols defaults to 3.</entry> <entry>
number of columns in the table. if the cols-attribute is empty,
but rows are given, then the number of cols is computed by the number
of rows and the number of elements to display to be just enough cols to
display all elements. If both, rows and cols, are omitted cols defaults
to 3.
</entry>
</row> </row>
<row> <row>
<entry>rows</entry> <entry>rows</entry>
<entry>integer</entry> <entry>integer</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>empty</emphasis></entry> <entry><emphasis>empty</emphasis></entry>
<entry>number of rows in the table. if the rows-attribute is empty, but cols are given, then the number of rows is computed by the number of cols and the number of elements to display to be just enough rows to display all elements.</entry> <entry>
number of rows in the table. if the rows-attribute is empty, but
cols are given, then the number of rows is computed by the number of
cols and the number of elements to display to be just enough rows to
display all elements.
</entry>
</row> </row>
<row> <row>
<entry>inner</entry> <entry>inner</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>cols</emphasis></entry> <entry><emphasis>cols</emphasis></entry>
<entry>direction of consecutive elements in the loop-array to be rendered. <emphasis>cols</emphasis> means elements are displayed col-by-col. <emphasis>rows</emphasis> means elements are displayed row-by-row.</entry> <entry>
direction of consecutive elements in the loop-array to be
rendered. <emphasis>cols</emphasis> means elements are displayed
col-by-col. <emphasis>rows</emphasis> means elements are displayed
row-by-row.
</entry>
</row> </row>
<row> <row>
<entry>table_attr</entry> <entry>table_attr</entry>
<entry>string</entry> <entry>string</entry>
@@ -76,58 +89,69 @@
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>&amp;nbsp;</emphasis></entry> <entry><emphasis>&amp;nbsp;</emphasis></entry>
<entry>value to pad the trailing cells on last row with <entry>value to pad the trailing cells on last row with (if any)</entry>
(if any)</entry>
</row> </row>
<row> <row>
<entry>hdir</entry> <entry>hdir</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>right</emphasis></entry> <entry><emphasis>right</emphasis></entry>
<entry>direction of each row to be rendered. possible values: <emphasis>left</emphasis> (left-to-right), <emphasis>right</emphasis> (right-to-left)</entry> <entry>
direction of each row to be rendered. possible values:
<emphasis>left</emphasis> (left-to-right), <emphasis>right</emphasis>
(right-to-left)
</entry>
</row> </row>
<row> <row>
<entry>vdir</entry> <entry>vdir</entry>
<entry>string</entry> <entry>string</entry>
<entry>No</entry> <entry>No</entry>
<entry><emphasis>down</emphasis></entry> <entry><emphasis>down</emphasis></entry>
<entry>direction of each column to be rendered. possible values: <emphasis>down</emphasis> (top-to-bottom), <emphasis>up</emphasis> (bottom-to-top)</entry> <entry>
direction of each column to be rendered. possible values:
<emphasis>down</emphasis> (top-to-bottom), <emphasis>up</emphasis>
(bottom-to-top)
</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</informaltable> </informaltable>
<para> <para>
<emphasis>html_table</emphasis> is a custom function that dumps an <emphasis>html_table</emphasis> is a custom function that dumps an array of
array of data into an HTML table. The <emphasis>cols</emphasis> data into an HTML table. The <emphasis>cols</emphasis> attribute determines
attribute determines how many columns will be in the table. The how many columns will be in the table. The <emphasis>table_attr</emphasis>,
<emphasis>table_attr</emphasis>, <emphasis>tr_attr</emphasis> and <emphasis>tr_attr</emphasis> and <emphasis>td_attr</emphasis> values
<emphasis>td_attr</emphasis> values determine the attributes given determine the attributes given to the table, tr and td tags. If
to the table, tr and td tags. If <emphasis>tr_attr</emphasis> or <emphasis>tr_attr</emphasis> or <emphasis>td_attr</emphasis> are arrays,
<emphasis>td_attr</emphasis> are arrays, they will be cycled through. they will be cycled through. <emphasis>trailpad</emphasis> is the value put
<emphasis>trailpad</emphasis> is the value put into the trailing into the trailing cells on the last table row if there are any present.
cells on the last table row if there are any present.
</para> </para>
<example>
<title>html_table</title>
<programlisting>
<![CDATA[
index.php:
<example>
<title>html_table</title>
<programlisting role="php">
<![CDATA[
<?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[
{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}
]]>
OUTPUT: </programlisting>
<para>
The above example will output:
</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>
@@ -143,9 +167,11 @@ OUTPUT:
<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> ]]>
</example> </screen>
</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