Re: Re: PEAR Template IT-X displaying 2 columns of data
| From: | Louie Miranda | Date: | Wed, 15 Nov 2006 01:05:49 +0000 |
| Subject: | Re: Re: PEAR Template IT-X displaying 2 columns of data | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25831@lists.php.net to get a copy of this message | ||
This works perfectly..
<table border="1">
<!-- BEGIN row -->
<tr>
<!-- BEGIN col --><td>{NAME}</td><!-- END col -->
</tr>
<!-- END row -->
</table>
To be able to adjust the col
if (++$i%2 == 0) { <-- current is 2
just set this to 3 for 3 col of data
Thanks again!
Louie
On 11/14/06, David Soria Parra <dsoria@gmx.net> wrote:
Hi Like this? 1 2 3 4 5 6 I am able to display tables only on a single row..You have to do something like: --- TEMPLATE.tpl --- <!-- BEGIN row --><!-- BEGIN col -->{NAME} <!-- END col --> <!-- END row -->" --- SOURCE.php --- <?php require_once("HTML/Template/IT.php"); $tpl = new HTML_Template_IT("."); $tpl->loadTemplatefile("TEMPLATE.tpl", true, true); $fonts = array(1,2,3,4,5,6); foreach ($fonts as $name) {foreach ($fonts as $name) {$tpl->setCurrentBlock('row'); $tpl->setVariable('ID', $name['id']); $tpl->setVariable('LANGUAGE', $name['language']); $tpl->setVariable('NAME', $name['name']); $tpl->setVariable('DESC', $name['desc']); $tpl->setVariable('_SIDE', $font_side_name); $tpl->parseCurrentBlock('row');}
$tpl->setVariable("NAME", $name);
$tpl->parse("col");
if (++$i%2 == 0) {
$tpl->parse("row");
}
}
$tpl->show();
---- RESULTS -----
1 2
3 4
5 6
-------------------
If you want HTML Template IT not to create newlines dont add them to the
templatefile so do something like:
<!-- BEGIN foo -->my {CONTENT}<!-- END foo-->
and NOT
<!-- BEGIN foo -->
my {CONTENT}
<!-- END foo-->
Greets
David
--
PEAR General Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Louie Miranda (lmiranda@gmail.com)
http://www.axishift.com
//JSM-W