Categories > TinyButStrong general >

array block problem

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: pedro
Date: 2009-03-05
Time: 15:39

array block problem

I do have a problem with block iteration.

i`ve been trying to to the following:
php code:
$out = array('msisdn' => 1234567', 'Paging Time' => '120');
foreach($out as $k => $v) {
    $obj = new stdclass();
    $obj ->fieldName = $k;
    $obj->fieldValue = $v;   
    $trafficatestoutput[] = $obj;
}
print_r($trafficatestoutput);
$TBS->MergeBlock('output', $trafficatestoutput);

Template Code:

<table border="1px">
            <tr>
                <td>[output.fieldName;block=tr;</td>
            </tr>

            <tr>
                <td>[output.fieldValue;block=tr;]</td>
            </tr>
            <tr bgcolor="#FFCFB9">
                <td colspan="2">[output;block=tr;nodata]There is no data. </td>
            </tr>
        </table>

But the Layout not the way i lke it.

i need to have the fieldNAme in one row iterated and the fieldValue in the next row.
how to i have to do it?
Any help?

Thanx
By: Skrol29
Date: 2009-03-06
Time: 17:47

Re: array block problem

Hi pedro,

   <tr>
    <td>[output.fieldName;block=tr+tr]</td>
   </tr>

   <tr>
    <td>[output.fieldValue]</td>
   </tr>
By: pedro
Date: 2009-03-08
Time: 11:00

Re: array block problem

Thanx for the help,

but mabe i didnt explaned well, what i meant.

i need a html out put like this for every entry in the array ;o)

<tr>
    <tdoutput.fieldName</td>
    <td[output.fieldName</td>
   </tr>

   <tr>
    <td>output.fieldValue</td>
    <td>output.fieldValue</td>
   </tr>
each key in a td inside a tr und every array value inside a td inside the tr.

Thanks
By: Yj98
Date: 2009-03-10
Time: 15:17

Re: array block problem

php side:
$TBS->MergeBlock('output,output1', $trafficatestoutput);


html side:
<table border="1px">
   <tr>
    <td>[output.fieldName;block=td]</td>
   </tr>
   <tr>
    <td>[output1.fieldValue;block=td]</td>
   </tr>
</table>