Categories > TinyButStrong general >

Block Serial and SubBlock

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Marcos Borges
Date: 2006-09-19
Time: 17:02

Block Serial and SubBlock

PHP

Array
(
    [0] => Array
        (
            [0] => 00000000004
            [id] => 00000000004
            [1] => Bolero
            [nome] => Bolero
            [2] => 1
            [ativo] => 1
            [3] => 2006-08-25 19:09:00
            [datahora] => 2006-08-25 19:09:00
            [4] => 1
            [ordem] => 1
            [musica] => Array
                (
                    [0] => Array
                        (
                            [0] => 00000000001
                            [id] => 00000000001
                            [1] => Musica 01
                            [nome] => Musica 01
                            [2] => 2006-09-19 11:16:54
                            [datahora] => 2006-09-19 11:16:54
                            [3] => 1
                            [ativo] => 1
                            [4] => 00000000004
                            [id_galeria] => 00000000004
                            [5] =>
                            [ordem] =>
                        )
                   [1] => Array
                        (
                            [0] => 00000000011
                            [id] => 00000000011
                            [1] => Musica 12
                            [nome] => Musica 12
                            [2] => 2006-09-19 11:16:54
                            [datahora] => 2006-09-19 11:16:54
                            [3] => 1
                            [ativo] => 1
                            [4] => 00000000004
                            [id_galeria] => 00000000004
                            [5] =>
                            [ordem] =>
                        )


                )

        )

    [1] => Array
        (
            [0] => 00000000002
            [id] => 00000000002
            [1] => Rock anos 60
            [nome] => Rock anos 60
            [2] => 1
            [ativo] => 1
            [3] => 2006-08-25 19:08:43
            [datahora] => 2006-08-25 19:08:43
            [4] => 2
            [ordem] => 2
            [musica] => Array
                (
                    [0] => Array
                        (
                            [0] => 00000000002
                            [id] => 00000000002
                            [1] => Teste 01
                            [nome] => Teste 01
                            [2] => 2006-09-19 11:38:19
                            [datahora] => 2006-09-19 11:38:19
                            [3] => 1
                            [ativo] => 1
                            [4] => 00000000002
                            [id_galeria] => 00000000002
                            [5] =>
                            [ordem] =>
                        )

                )

        )

    [2] => Array
        (
            [0] => 00000000001
            [id] => 00000000001
            [1] => asd
            [nome] => asd
            [2] => 1
            [ativo] => 1
            [3] =>
            [datahora] =>
            [4] => 3
            [ordem] => 3
            [musica] => Array
                (
                )

        )

    [3] => Array
        (
            [0] => 00000000003
            [id] => 00000000003
            [1] => Rock anos 70
            [nome] => Rock anos 70
            [2] => 1
            [ativo] => 1
            [3] => 2006-08-25 19:08:51
            [datahora] => 2006-08-25 19:08:51
            [4] => 4
            [ordem] => 4
            [musica] => Array
                (
                )

        )

)





HTML
<div style="width:465px; margin-bottom:10px;" >
    <div style="float:left; width:230px; text-align:center;" >
    <strong>[blk_galeria_1.nome; ope=max:15; block=div] ([blk_galeria_1.$])</strong>
    <li>    [blk_musica.nome; ope=max:15; block=li; p1=[blk_galeria_1.$];]</li>
    </div>
    <div style="float:right;width:230px; text-align:center;" >
    <strong>[blk_galeria_2.nome; ope=max:15; block=div;.] ([blk_galeria_2.$])
    </strong>   
    <li>    [blk_musica.nome; ope=max:15; block=li; p1=[blk_galeria_2.$];] </li>
        [blk_galeria;block=((div));serial]   
    </div>
</div>


RESULT
Bolero (0) [blk_musica.nome; ope=max:15; block=li; p1=0;] Rock anos 60 (1) [blk_musica.nome; ope=max:15; block=li; p1=1;] asd (2) [blk_musica.nome; ope=max:15; block=li; p1=2;] Rock anos 70 (3) [blk_musica.nome; ope=max:15; block=li; p1=3;]


The subblocks no merge.
Do you help me.
By: Skrol29
Date: 2006-09-20
Time: 00:10

Re: Block Serial and SubBlock

Hello,

What is the PHP code ?
By: Anonymous
Date: 2006-09-20
Time: 01:09

Re: Block Serial and SubBlock


$resultado = $objConn->carrega_array("SELECT * FROM tb_galeria_musicas WHERE ativo = '1' ORDER BY ordem");
for($i = 0; $i < count($resultado); $i++ ){
    $resultado[$i]['musica'] = $objConn->carrega_array("SELECT * FROM tb_musicas WHERE ativo = '1' AND id_galeria = '" . $resultado[$i]['id'] . "' ORDER BY ordem");
}

$objTBS->LoadTemplate("html/site/interno/galeria_musicas.htm");
$objTBS->MergeBlock("blk_galeria",'array','resultado');
$objTBS->MergeBlock("blk_galeria",'array','resultado[%p1%][musica]') ;

$html_tmp = $objTBS->Show();


the result of sql query is first code print in top of this page.
By: Skrol29
Date: 2006-09-20
Time: 21:07

Re: Block Serial and SubBlock

It should be
$objTBS->MergeBlock("blk_galeria",'array','resultado');
$objTBS->MergeBlock("blk_musica",'array','resultado[%p1%][musica]') ;