Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/07/2007, 11:36
Avatar de SI TAN SOLO TUVIERA
SI TAN SOLO TUVIERA
 
Fecha de Ingreso: marzo-2006
Ubicación: Aburrilandia, US
Mensajes: 652
Antigüedad: 18 años, 1 mes
Puntos: 3
Pregunta Como hago para meter todo el contenido de este <div> en un echo?

Hola.

Estoy tratando de usar una funcion para que me intercale los colores de fondo celda cuando imprime los datos que vienen de una BD.

Mi problema es que dentro de esa celda, que se imprime con un echo, acorde a la funcion, necesito meter todo el contenido de este div.

Código PHP:
<div class="content" onmouseover='this.style.background="#FFF4CE"' onmouseout='this.style.background="#FFFDEE"'>
             
              <table style="width:672px">
                <tr style="font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#000000">
                  <td width="35">
                    <input type="checkbox" name="compare[]" value="<?php echo $row["id"?>" style="border: 0px solid #C5C5C5" onClick="createCookie('compare_'+this.value,this.value,'')" >
                  </td>
                  <td align="left" width="77" style="vertical-align:middle">
                     <?php 
                            $is_there_image 
"no";
                            
$image_name="";
                            for(
$j=1;$j<=12;$j++)
                            { 
                                if(
$j==1)
                                {
                                    
$image_name_number $row["stock"].".jpg";
                                    
$image_name_letter $row["stock"].".jpg";
                                }
                                else
                                {
                                    
$image_name_number $row["stock"]."-".$j.".jpg";
                                    
$image_name_letter $row["stock"]."__".chr($j+63).".jpg";
                                }
                                
                                if(
is_file($upload_image_path.$row["member_id"]."/".$image_name_number))
                                {
                                    
$is_there_image "yes";
                                    
$image_name $image_name_number;
                                    break;
                                }
                            
                                if(
is_file($upload_image_path.$row["member_id"]."/".$image_name_letter))
                                {
                                    
$is_there_image "yes";
                                    
$image_name $image_name_letter;
                                    break;
                                }
                            }
//for($j=1;$j<=12;$j++)
                        
                        
                        
if($is_there_image == "yes")
                        {
                          
$image_sizes=GetImageSize($upload_image_path.$row["member_id"]."/".$image_name);
                          
/********IF THE IMAGE IS SMALLER THAN RESIZED IMAGE ****************/
                          
if($image_sizes[0]<= "100")
                               
$new_width $image_sizes[0];
                          else
                               
$new_width "100";
                          
/***************CALCULATING THE HEIGHT OF THE NEW(RESIZED) IMAGE*********************/
                          
$width_ration=$image_sizes[0]/$new_width;//calculating the ratio between the width of the original and the new(resized) image
                          
$new_height=round($image_sizes[1]/$width_ration);//the height of the new image
                    
?>
<img src="images/triangulito2.gif" width="4" height="7" border="0"/>&nbsp;<a href="<?=$site_secure_URL?>/images/<?=$row["member_id"]?>/<?= $image_name?>" rel="lightbox" title="<?php echo $row["year"?>&nbsp;
        <?php echo $row["model"?>&nbsp; 
        <?php echo $row["type"?> - &lt;a href=&quot;details.php?id=<?= $row["id"?>&quot;&gt;more details&lt;/a&gt;"><font size="1">Fast Preview</font></a><br />
                <a href="details.php?id=<?= $row["id"?>"><img src="<?=$site_secure_URL?>/images/<?=$row["member_id"]?>/<?= $image_name?>" width="<?=$new_width ?>" height="<?=$new_height ?>" class="border1" /></a>
                <?php 
                        
}else{?>
                <img src="<?=$site_secure_URL?>include/images/noimage2.gif" width="75" class="border1" />
            <?php }?>            
                  </td>
                  <td align="left" width="1" style="vertical-align:middle">&nbsp;
                  </td>
                  <td width="280" align="left" style="vertical-align:middle">
                    <a href="details.php?id=<?= $row["id"?>"><span style="font-family:Arial, Helvetica, sans-serif; color:#0000FF; font-size:15px; font-weight:bold"> <?php echo $row["year"?>&nbsp; <?php echo $row["model"?>&nbsp; <?php echo $row["type"?></span></a> &nbsp;<a href="details.php?id=<?= $row["id"?>"><span style="color:#0000FF; font-size:10px; font-family:Verdana, Arial, Helvetica, sans-serif">[+] details</span>
                    </a>
                     <br />
                    Dealer: 
                    <a href="results.php?dealer_id=<?php echo $row["member_id"];?>">
                      <span style="font-size:10px; text-decoration:none"><?php echo $row["company"];?></span>
                    </a>
         <?php
  $d 
ds_distance($zip$row["zip"]);
  
  if (
$d == -1)
  {
    
$zip54 'in '.$row["city"];
     
/* echo " Not available"; */
  
}
  else
  {
  
$zip55 round($d,2);
  
$zip56 "miles away";
  } 
?>          
                      <span style="color:#666666; font-size:10px; font-style:italic; font-family:Georgia, "Times New Roman", Times, serif">&nbsp;<?php echo $zip54;?>
                      </span>
                      <span style="color:#666666; font-size:11px; font-style:italic; font-family:Verdana, Arial, Helvetica, sans-serif, Times, serif">&nbsp;<?php echo $zip55." ".$zip56;?> 
                      </span>
                        <br />
                       <img src="images/tele.gif"  style="vertical-align:middle"/>&nbsp;<span style=" vertical-align: middle; font-size:12px; font-family: Arial, Helvetica, sans-serif; color: #990000; font-weight: bold;"><?php echo $row["dealer_phone"];?>
                       </span> 
                       <br />
                      <a href="details.php?id=<?= $row["id"?>"><img src="images/camera.gif" width="13" height="13" border="0" title="See More Pictures"/>                      </a>  <?php echo $images_num?> photos.                  </td>       
                  <td align="left" width="5" style="vertical-align:middle">&nbsp;
                  </td>
                  <td align="left" width="55" style="vertical-align:middle"><span style="color:#990000; font-size:13px;  font-family: Arial, Helvetica, sans-serif;"><strong><?php 
                            
if(number_format($row["price"])!=0) {
                            echo 
"$".number_format($row["price"]); 
                            }else{
                            echo 
"<span style=\"color:#ff0000\">****</span>";}
                            
?></strong></span>                  </td>
                  <td align="left" width="5" style="vertical-align:middle; color:#869919">&nbsp;
                  </td>
                  <td align="left" width="55" style="vertical-align:middle"><span style="color:#990000; font-size:11px;  font-family: Arial, Helvetica, sans-serif;"><strong><?php if($row["color"]) { echo $row["color"]; }else{ echo "<span style=\"color:#ff0000\">****</span>";}?></strong></span>                  </td>
                  <td align="left" width="5" style="vertical-align:middle; color:#869919">&nbsp;
                  </td>
                  <td align="left" width="50" style="vertical-align:middle">
                    <span style="color:#990000; font-size:11px;  font-family: Arial, Helvetica, sans-serif;">
                      <strong><?php echo number_format($row["millage"]);?>                      </strong>                    </span>                  </td>
                  <td align="left" width="35" style="vertical-align:middle">
                    <?php if($row["is_new_car"]=="yes") {?>
                  <div align="right"><img src="<?=$site_secure_URL?>images/new_vehicle/<?php echo $new_vehicle_image_name.".jpg"?>?key=<?=time() ?>" > 
                  </div>
                    <?php ?>
                  </td>
                </tr>
              </table>
              
                     </div>
La funcion es esta, la saque de aqui de FDW

Código PHP:
<table>
<?php
$color
='#FF0000';  // este es el primer color que queremos que aparezca
for($i=0;$i<20;$i++)
{
    echo 
"<tr bgcolor=\"$color\"><td>AQUI DEBERIA IR TODO EL CONTENIDO DEL DIV, PERO NO ME FUNCA</td></tr>";
  
$color=('#F0F0F0'==$color)?'#FF0000':'#F0F0F0';
// este es el operador ternario. Equivale a un IF-THEN-ELSE
// Es quivalente a
//  if ('#F0F0F0'==$color)
//  {
//    $color='#FF0000';
//  } else
//  {
//    $color='#F0F0F0';
//  }

}
?>
</table>
Que puedo hacer ahi? Gracias por la ayuda!
__________________
¿Dónde encontrar carros baratos en USA? En Autopten.