Categories > TinyButStrong general >

Multi-dimensional array

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: euchre
Date: 2008-10-22
Time: 11:53

Multi-dimensional array

I get the following error when I tried to use TBS with multi-dimensional array.

TinyButStrong Error in field [blk.val...] : item 'val' is not an existing key in the array. This message can be cancelled using parameter 'noerr'.

Below are my codes.

Template.html
<html>
<body>
<table border="1">
<tr><td>
[blk.val;block=tr]
</td>
</tr>
</table>
</body>
</html>

index.php
include_once('tbs_class.php');
$TBS = new clsTinyButStrong ;
$TBS->LoadTemplate('template.html')
;
$list = array( array("rose", 1.25 , 15),
               array("daisy", 0.75 , 25),
               array("orchid", 1.15 , 7)
             );
$TBS->MergeBlock('blk',$list) ;
$TBS->Show() ;

Is there a fix to this problem?
By: TomH
Date: 2008-10-22
Time: 13:10

Re: Multi-dimensional array

The error message explains the problem, but is not telling you that your 'val' is an array not a value.

You have several possibilities to see how to address array members...
see http://www.tinybutstrong.com/examples.php
for ways to properly code access to various array items

(1) Select the example "Data (array)"
(2) In the top box "Display" select the various choics to see the php and template codes 
By: euchre
Date: 2008-10-22
Time: 15:26

Re: Multi-dimensional array

Thanks Tom!