Author Topic: Nested loops bug  (Read 1134 times)

0 Members and 1 Guest are viewing this topic.

leonidb

  • Guest
Nested loops bug
on: Mon, 24. February 2003 - 15:39:02
Seems like nested loops are not working at all. There are simplified code below:

In php code:
$phpgw->template->setLoop('paymenttypes',$paymenttypes);

In template:
<TMPL_LOOP formblock>
<TMPL_LOOP global.paymenttypes>test</TMPL_LOOP>
</TMPL_LOOP>

Also, if I try to make "paymenttypes" not a global loop, it not working as well

The same code have to work fine in old(slow) vLib versions.

leonidb

  • Guest
Nested loops bug
Reply #1 on: Mon, 24. February 2003 - 15:56:10
I wrong, with nonglobal loops its wroking fine, like:

$formblock=array(
 [0]=>array(
   'paymenttypes'=>array(...skiped...)
 )
)

It just not possible to access global loops
'GLOBAL_VARS' in ini are on, but in latest versions it affects only varibales, not loops

releasedj

  • Guest
Nested loops bug
Reply #2 on: Tue, 25. February 2003 - 10:37:54
Hi,

The loop within a loop can only be achieved by creating an inner loop within each row of a top level loop, using the correct array structure. (See docs.)
You can always build the inner loop first, and then assign it to each row when you're building the top level loop.

And as you correctly point out, the GLOBAL_VARS option is only for VARS.

Regards,

Kelvin

leonidb

  • Guest
Nested loops bug
Reply #3 on: Sun, 23. March 2003 - 13:57:58
Quote
inner loop within each row of a top level loop, using the correct array structure. (See docs.)


I known whats in docs. In previuos versions it was work another way, and there are a reasons why new logics are not fine.

Quote
You can always build the inner loop first, and then assign it to each row when you're building the top level loop.


Is it a good point? Are memory allocations work fast in php? What if some loop is logically must be global, and used in some particular rows in other loops.

releasedj

  • Guest
Nested loops bug
Reply #4 on: Sun, 23. March 2003 - 14:57:34
The structure of the loops have not changed.

Global are currently not available as you wish.

As I stated in another post.. this is open source, and if you would like to look into the source an see if what you would like is possible, then you can send in any changes.

Regards,

Kelvin

Offline ClausVB

  • Administrator
  • Hero Member
  • *****
  • Posts: 566
    • Homepage: clausvb.de
Nested loops bug
Reply #5 on: Sat, 29. March 2003 - 21:32:25
Quote
Seems like nested loops are not working at all.


Defenitly not true. I use nested loops throughout my applications.

Examples:
/forum/viewtopic.php?p=462#462
and
http://lamp.clausvb.de/examples/vlibTemplate_db_adv.php