Categories > TinyButStrong general >

Sub-blocks in 3 blocks

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: dede
Date: 2005-07-06
Time: 13:25

Sub-blocks in 3 blocks

Hi Morrigan,

How make an sub blocks which has 3 blocks inside of it?
'coz I just see in Example only show 2 blocks inside.

Give me an example plzz...
I have 3 depth data like below:

A -> a1  -> a1-1
            -> a1-2
       a2  -> a2-1
            -> a2-2
B -> b1  -> b1-1
            -> b1-2
       b2  -> b2-1
            -> b2-2

and on html is can be shown like this:

-------------------------
A      a1       a1-1
                   a1-2
         a2       a2-1
                   a2-2
B      b1       b1-1
                   b1-2
         b2       b2-1
                   b2-2
-------------------------


Thnx.


Dede.
By: Skrol29
Date: 2005-07-07
Time: 11:06

Re: Sub-blocks in 3 blocks

Your data are in a table or in a Php array ?
By: dede
Date: 2005-07-08
Time: 04:05

Re: Sub-blocks in 3 blocks

which one more simple ?
maybe for now, just assumed using array

Thnx.



Dede.
By: Skrol29
Date: 2005-07-08
Time: 13:22

Re: Sub-blocks in 3 blocks

> which one more simple ?

The difference is just on the query.

Here is an example with data stored into a Php array like:
   $src['A'] = array('a1'=>'a1-1');

HTML:
<table border="1" cellspacing="0" bordercolor="#0000FF">
  <tr>
    <td>[b1.$;block=tr]</td>
    <td>
      <table border="1" cellspacing="0" bordercolor="#FF0000">
        <tr>
          <td>[b2.$;block=tr;p1=[b1.$]]</td>
          <td>
            <table border="1" cellspacing="0" bordercolor="#00FF00">
              <tr>
                <td>[b3.key;block=tr;p1=[b1.$];p2=[b2.$]]</td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

PHP:
$TBS->MergeBlock('b1','array','src');
$TBS->MergeBlock('b2','array','src[%p1%]');
$TBS->MergeBlock('b3','array','src[%p1%][%p2%]');
By: Pirjo Posio
Date: 2005-07-08
Time: 19:28

Re: Sub-blocks in 3 blocks

Thank you, Skrol29!

To hopefully save newbies some time:
To get output exactly like dede asked, the data should be as:
$src = array (
  'A' => array ('a1' =>array('a1-1','a1-2'),'a2'=>array('a2-1','a2-2')),
  'B' => array ('b1' =>array('b1-1','b1-2'),'b2'=>array('b2-1','b2-2')),
  'C' => array ('c1' =>array('c1-1','c1-2'),'c2'=>array('c2-1','c2-2'))
);

And in the html 'bk.val' instead of 'b3.key'.
By: dede
Date: 2005-07-11
Time: 05:14

Re: Sub-blocks in 3 blocks

Yes!
Correct.

This is what I need ;)

Thnx a lot for you guys :)



[dede]