|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
piropeator Smarty Rookie
Joined: 31 Oct 2007 Posts: 26
|
Posted: Fri Oct 08, 2010 11:13 pm Post subject: Pasar de PHP a plantilla Smarty |
|
|
En internet encontré este código que es para alternar colores en las filas de un listado, está en PHP:
Code: | echo "<table width='100%'>";
while($array = mysql_fetch_array($cad)) {
if ($colorfila==0){
$color= "#DEDEBE";
$colorfila=1;
}else{
$color="#F0F0F0";
$colorfila=0;
}
echo "<tr><td bgcolor='".$color."'><font face='Arial' size='2'>".$array['titulo']."</font></td></tr>";
}
echo "</table>"; |
Quiero transformar el codigo para utilizarlo en una plantilla TPL de smarty, ya logré incluir el while utilizando {section y loop}, pero la parte del IF, el displayado y el $color no funcionan, incluso utilizando {php}...{/php}
Cómo logro esto?
El codigo lo encontré aquí: http://www.webexperto.com/articulos/art/143/alternar-el-color-de-filas-en-paginacion/
Gracias. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|