Hello paula,

Monday, April 09, 2001, 6:47:21 AM, you wrote:

p> I was sending desperate emails to this list related to nested loops and array 
comparision.
p> Well, just let you know that the problem seems to be that I'm using this with PHPLIB
p> templates and those can't handle nested loops.

template.html:
<table>

<!-- BEGIN row -->
<tr>
<!-- BEGIN column -->
<td>{val}</td>
<!-- END column -->
</tr>
<!-- END row -->
</table>

code:
// place here some code for multi-row multi-column data array

$tpl = new Template;
$tpl->set_file('tp', 'template.html');
$tpl->set_block('tp', 'row', 'row_parsed');
$tpl->set_block('row', 'column', 'column_parsed');

foreach ($rows as $row => $columns) {

  /* IMPORTANT: free the column block from previous results,
  do it like this: */
  $tpl->set_var('column_parsed', '');
  
  foreach ($columns as $column) {
     $tpl->set_var('val', $column);
     $tpl->parse('column_parsed', 'column', true);
  }
  $tpl->parse('row_parsed', 'row', true);
}
$tpl->pparse('out', 'tp');

So, you have nested blocks filled with nested loops.



-- 
Best regards,
Maxim Derkachev mailto:[EMAIL PROTECTED]
Symbol-Plus Publishing Ltd.
phone: +7 (812) 324-53-53
http://www.Books.Ru -- All Books of Russia
 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to