Categories > TinyButStrong general >

TBS et multi dimensional array

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: christophe
Date: 2013-07-11
Time: 11:13

TBS et multi dimensional array

Hello,

I've a php array formated like that:

Array (
  [REGIO - FUNCT] =>
      Array (
          [@info1] => Array (
             [0] => Array (
                 [module_id] => 3
                 [module_key] => REGIO
                 )
             [1] => Array (
                 [module_id] => 5
                 [module_key] => OTHER
                 )
                                       )
         [@info2] => ...
     )
  [REGIO - OTH] => ....
)

i would like to display something like that:

REGIO - FUNCT
   @info1
      REGIO - 3
   @info2
      OTHER - 5
REGIO - OTH
   @infoX
      XYZ - 0
...

But i've an error with this:
$this->TBS->MergeBlock('mybig',$mybigArray);

[mybig.key;BLOCK=TBS:PAGE]

[mybig.key...]: item 'key' is not an existing key in the array
By: Sarah Kemp
Date: 2013-07-11
Time: 17:10

Re: TBS et multi dimensional array

Do you have a key in your array called 'key'? If not, the error is very valid. If you want to show the key, use $ as shown in the manual. E.g.:
[mybig.$;block=tbs.page]
By: christophe
Date: 2013-07-11
Time: 17:13

Re: TBS et multi dimensional array

Ok, just succed to display 2 levels:

[mybig.$;block=tbs.page;sub1]
[mybig_sub1.$;block=tbs.title;sub1]
[mybig_sub1_sub1.module_id;block=tbs.p]

But the last array with module_id and module_key i'm not enable to display...