Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/06/2004, 13:22
Avatar de Reynier
Reynier
 
Fecha de Ingreso: noviembre-2002
Ubicación: Por ahí en algún sitio
Mensajes: 1.844
Antigüedad: 21 años, 5 meses
Puntos: 1
Alternar colores

La cosa es que estuve leyendo este post http://www.forosdelweb.com/showpost....9&postcount=31 y vi como lo hacian para alternar los colores de las filas. Ahora yo tengo estas funciones:
Código PHP:
function ShowCatForum(){
  
$query "select * from rpmf_catforos where active<>0 order by presentation_order asc";
  
$result mysql_query($query) or die("No se pudo ejecutar la consulta $query. MySQL ha dicho: ".mysql_error());
  
$cant mysql_num_rows($result);
  if(
mysql_num_rows($result)!=0){
   while(
$show=mysql_fetch_assoc($result)){
    echo 
"<tr><td class='tr font padding topics bold' colspan='4'><span class='info' title='".$show['description']."'>".$show['title']."</td></tr>";
    
ShowForos($show['idcat']);
   }
  }else{
    echo 
"<tr><td class='td font padding topics bold' colspan='4' align='center'>No tenemos ninguna categoría para mostrar</td></tr>";
  }
 } 
que se encarga de mostrarme todas las categorias disponibles. Y esta otra:
Código PHP:
function ShowForos($idcat){
  
$query "select * from rpmf_foros where idcat=".$idcat." and active<>0 order by presentation_order asc";
  
$result mysql_query($query) or die("No se pudo ejecutar la consulta $query. MySQL ha dicho: ".mysql_error());
  if(
mysql_num_rows($result)!=0){
   while(
$show=mysql_fetch_assoc($result)){
    
# Obtenemos la cantidad de post que tiene ese Foro
    
$query1 "select *,count(idpost) as cant from rpmf_post where idforo=".$show['idforo']." group by idforo";
    
$result1 mysql_query($query1) or die("No se pudo ejecutar la consulta $query1. MySQL ha dicho: ".mysql_error());
    
$show1 mysql_fetch_assoc($result1);

    
# Obtenemos la cantidad de respuestas que tiene ese Foro
    
$query2 "select *,count(idreply) as cant from rpmf_reply where idforo=".$show['idforo']." group by idforo";
    
$result2 mysql_query($query2) or die("No se pudo ejecutar la consulta $query2. MySQL ha dicho: ".mysql_error());
    
$show2 mysql_fetch_assoc($result2);

    
# Obtenemos el nombre del último usuario que posteo el mensaje
    
$query3 "select rp.idforo,rp.iduser,rp.date, dayofmonth(rp.date) as dia, dayofweek(rp.date) as semana, month(rp.date) as mes, year(rp.date) as year, date_format(rp.date,'%h:%i %p') as hora, us.* from rpmf_reply rp, rpmf_users us where rp.idforo=".$show['idforo']." and rp.iduser=us.iduser";
    
$result3 mysql_query($query3) or die("No se pudo ejecutar la consulta $query3. MySQL ha dicho: ".mysql_error());
    
$show3 mysql_fetch_assoc($result3);

    
# Obtenemos la cantidad de temas
    
if(mysql_num_rows($result1)!=0){
     
$topics $show1['cant'];
    }else{
     
$topics 0;
    }

    
# Obtenemos la cantidad de respuestas
    
if(mysql_num_rows($result2)!=0){
     
$reply $show1['cant'] + $show2['cant'];
    }else{
     
$reply 0;
    }
    
# Formamos la fecha
    
$fecha MakeDate($show3['dia'],$show3['semana'],$show3['mes'],$show3['year'],$show3['hora'],$show3['login'],$show3['iduser'],"small");
    echo 
"<tr>
          <td width='50%' class='td font padding' align='left'><a href='viewforo.php?catforo="
.$idcat."&foro=".$show['idforo']."&".SID."'>".$show['title']."</a> | Moderado por: </td>
          <td width='13%' class='td font padding' align='center'>"
.$topics."</td>
          <td width='15%' class='td font padding' align='center'>"
.$reply."</td>
          <td width='20%' class='td font padding' align='center'>"
.$fecha."</td>
          </tr><tr>
          <td colspan='5' align='left' class='td font padding'>"
.$show['description']."</td>
          </tr>"
;
   }
  }else{
   echo 
"<tr><td colspan='5' align='center' class='td font padding topics bold'>No hay foros disponibles para mostrar en esta categoría</td></tr>";
  }
 } 
que se encarga de mostrarme los Foros disponibles para esa categoria dada. Ahroa como podría hacer aqui para alternar los colores de las filas.

Salu2
__________________
Ing. Reynier Pérez Mira