Ver Mensaje Individual
  #6 (permalink)  
Antiguo 26/07/2007, 21:40
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
Re: ¿Cómo hago para que al imprimir me intercale dos colores de fondo de celda?

Gracias Centinela por el aporte, pero sigo confundido, me explico.

Entendi y me funciono el algoritmo de los FAQ de aqui de los FDW, creo que es muy facil cuando quieres meter un HOLA o imprimir una $ no mas dentro de los <td></td>

Pero como hago, cuando lo que quiero imprimir detro de esos <td></td> es todo este chorrero:

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>
Ahi si no tengo ni idea, por que se me confunde el html y el php, y el echo no me interpreta todo eso y sencillament no me funciona, no puedo hacer esto, que confusion home!:

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\"><div>TODO EL CHORRERO AQUIM</div></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>



... a proposito el FAQ de aqui de los FDW funciona bien.. pero cuando en vez de tables uso div, ya no funca..

Agradezco cualquuier ayuda!!
__________________
¿Dónde encontrar carros baratos en USA? En Autopten.

Última edición por SI TAN SOLO TUVIERA; 27/07/2007 a las 07:20