Ya lo se, se q no es bueno ni recomendable, pero es q necesito hacerlo asi, ya q luego muestro recorriendo todo el array.
Os explico, estoy desarrollando un motor de templates y tengo problemas con los bloques, osea las zonas q qremos repetir X veces.
Lo q hago es genero el html con dreamweaver y para los bloques implemento lo siguiente.
header.html
Código PHP:
<table>
<block>
<tr>
<td>{titulo}</td><td>{texto}</td>
</tr>
</block>
</table>
Luego en el codigo php (index.php)
index.php
Código PHP:
include('class-tpl.php');
$html = new SpynTPL("themes/");
$html->Fichero("header.html");
$result = $db->query("SELECT * FROM ".PREFIX."_noticias");
$aNot = array();
while ($row = $db->fetch_row($result))
{
$aNot = array_merge($aNot,array ( 'titulo' => $row[0], 'texto' =>$row[2]));
}
$html->Asigna($aNot);
Y deberia salir esto.
salida
Código PHP:
<table>
<tr>
<td>TITULO 1</td><td>TEXTO1</td>
</tr>
<tr>
<td>TITULO 2</td><td>TEXTO2</td>
</tr>
</table>