Sample> Multiple Loop Bloc

<?php

// include TPLN
include('TPLN/TPLN.php');

$TPLN = new TPLN;
$TPLN->open('multiple_loop_bloc.html');


// bloc 1
srand((double)microtime()*1000000);
$indice1 rand(0,5);

for(
$i 0$i $indice1$i ++)
{
     
$TPLN->parse('bloc1.texte1'"Bloc no $i");

     
// bloc 2
     
srand((double)microtime()*1000000);
     
$indice2 rand(0,5);

     for(
$j 0$j $indice2$j ++)
     {
        
$TPLN->parse('bloc1.bloc2.texte2'"Bloc no $i.$j");

        
// bloc 3
        
srand((double)microtime()*1000000);
        
$indice3 rand(0,5);

        for(
$k 0$k $indice3$k ++)
        {
            
$TPLN->parse('bloc1.bloc2.bloc3.texte3'"Bloc no $i.$j.$k");
            
$TPLN->loop('bloc1.bloc2.bloc3');
        }

        if(
$indice3 == 0)
        {
            echo 
"Erase bloc 3 in this session $i.$j<br>";
            
$TPLN->eraseBloc('bloc1.bloc2.bloc3');
        }

        
$TPLN->loop('bloc1.bloc2');
     }

    if(
$indice2 == 0)
    {
        echo 
"Erase bloc 2 in this session $i<br>";
        
$TPLN->eraseBloc('bloc1.bloc2');
    }

    
$TPLN->loop('bloc1');
}

// erase bloc if empty looped
if($indice1 == 0)
{
  echo 
'Erase bloc 1<br>';
  
$TPLN->eraseBloc('bloc1');
}


$TPLN->write();



?>
<html >
<head >
    <title >TPLN - Multiple Loop Bloc Sample</title >
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head >
<body >

<form method="post" >
    <input type="button" value="Reload Window" onClick="window.location.reload()" />
</form >
<br >
<br >

<table width="70%" align="center" bgcolor="#FFFFFF" cellspacing="1" >

    <bloc::bloc1>
        <tr valign="top" >
            <td >

                <table width="90%" align="center" bgcolor="#9BB0F9" >
                    <tr valign="top" >
                        <td align="center" > </td >
                    </tr >
                    <tr valign="top" >
                        <td >{texte1}</td >
                    </tr >

                    <bloc::bloc2>
                        <tr valign="top" >
                            <td >
                                <table width="90%" align="center" bgcolor="#9DD89D" >
                                    <tr valign="top" >
                                        <td align="center" > </td >
                                    </tr >
                                    <tr valign="top" >
                                        <td >{texte2}</td >
                                    </tr >

                                    <bloc::bloc3>
                                        <tr valign="top" >
                                            <td >
                                                <table width="90%" align="center" bgcolor="#E9E66B" >
                                                    <tr valign="top" >
                                                        <td align="center" > </td >
                                                    </tr >
                                                    <tr valign="top" >
                                                        <td >{texte3}</td >
                                                    </tr >
                                                </table >
                                            </td >
                                        </tr >
                                    </bloc::bloc3>

                                </table >
                            </td >
                        </tr >

                    </bloc::bloc2>

                </table >
            </td >
        </tr >
        
    </bloc::bloc1>

</table >

<br >
<br >
{_Logo}<font size="1" > in {_Chrono} s<br >
    Queries executed: {_QueryCount}</font >


</body >
</html >