Page 1 sur 1

retour a la ligne

Posté : 08 juil. 2005, 15:52
par lefox88500
Bonjour a tous
ci dessous voici mon code
en faite avce ce code je voudrais tous simplement ke la partie ou il y a lecture de mon csv qu'il saffiche dans un tableau ce qu'il fait sans probleme

mais je voudrai pas que la largeur de la cellule ou sa s'affiche soi fixé (car la elle s'agrandi en fonction de la longueur du text)


<html>
<head>
<title>MVM</title>
</head>
<body>
<TABLE border=2 width=975>
<tr>
<td width=158 height=173>
<img src="logo.jpg" width="157.5" height="172.5" alt="" border="0" />
</td>
<td valign="top">
 
<FONT SIZE=2>
<FONT COLOR="#0000FF">
<div align="right">
<?php
$date = date("d-m-Y");
Print("Nous sommes le $date");
?>
<br>
<FONT SIZE=2>
 <?php
$heure = date("H:i");
Print("il est $heure");
?>
</div>
</FONT>
</td>
</tr>
</table>

<br>

<p align="center"><b><font size="3" ><u>News du Site</u><br>
  </b></p>
<p align="center">&nbsp;</p>

<table width="230" border="2" align="center">
  <tr > 
    <td width="200" align="center"> 
      <div align="center">

<?
$separateur=";";
$champ="c:\EasyPHP1-8\www\champ.csv";
function read_csv( $champ, $separateur)    
{
 if ( $FILE=fopen($champ,"r") )              
 {
  while ($ARRAY[]=fgetcsv($FILE,1024,$separateur));  
  fclose($FILE) ;
  array_pop($ARRAY);                                                               
  return $ARRAY ;                             
 }
}
$ARRAY=read_csv($champ,$separateur);      
?>
 <? 
$heigh=sizeof($ARRAY);           
$width=sizeof($ARRAY[0]);
$ARRAY=array_reverse($ARRAY,false); 
echo "<TABLE>";                          
for($i=0;$i<3;$i++)                
 {
	echo "<TR>\n";                      
      for($j=1;$j<3;$j++) 
	  {    
     echo "<TD>";
     if( $ARRAY[$i][$j]=="" )         
          echo "";
     else                         
     {
		 echo "<center>";
         echo htmlspecialchars($ARRAY[$i][$j], ENT_QUOTES);
         echo "</center>";
     }
     echo "</TD>\n";
	   }            
    echo "</TR>\n";                  
}

echo "</TABLE>\n";                     
?>

 </tr >
 </td>
 </table> 
 
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="www.mvm-parisot.com"><img src="parisot3.JPG" width="83" height="82" border="0"></a> 
</p>
<tr>
<td width=158 heigh=173>
</td>
</tr>
<table> 
</body>
</html>

merci d'avnace a ceux qui vont repondre

Posté : 08 juil. 2005, 17:48
par rami
Il faut fixer la taille de ta cellule. Par exemple, 200px.
html>
<head>
<title>MVM</title>
</head>
<body>
<TABLE border=2 width=975>
<tr>
<td width=158 height=173>
<img src="logo.jpg" width="157.5" height="172.5" alt="" border="0" />
</td>
<td valign="top">

<FONT SIZE=2>
<FONT COLOR="#0000FF">
<div align="right">
<?php
$date = date("d-m-Y");
Print("Nous sommes le $date");
?>
<br>
<FONT SIZE=2>
<?php
$heure = date("H:i");
Print("il est $heure");
?>
</div>
</FONT>
</td>
</tr>
</table>

<br>

<p align="center"><b><font size="3" ><u>News du Site</u><br>
  </b></p>
<p align="center">&nbsp;</p>

<table width="230" border="2" align="center">
  <tr >
    <td width="200" align="center">
      <div align="center">

<?
$separateur=";";
$champ="c:\EasyPHP1-8\www\champ.csv";
function read_csv( $champ, $separateur)    
{
if ( $FILE=fopen($champ,"r") )              
{
  while ($ARRAY[]=fgetcsv($FILE,1024,$separateur));  
  fclose($FILE) ;
  array_pop($ARRAY);                                                               
  return $ARRAY ;                             
}
}
$ARRAY=read_csv($champ,$separateur);      
?>
<?
$heigh=sizeof($ARRAY);           
$width=sizeof($ARRAY[0]);
$ARRAY=array_reverse($ARRAY,false);
echo "<TABLE>";                          
for($i=0;$i<3;$i++)                
{
    echo "<TR>\n";                      
      for($j=1;$j<3;$j++)
      {    
     echo "<TD width=\"200\">";
     if( $ARRAY[$i][$j]=="" )         
          echo "";
     else                         
     {
         echo "<center>";
         echo htmlspecialchars($ARRAY[$i][$j], ENT_QUOTES);
         echo "</center>";
     }
     echo "</TD>\n";
       }            
    echo "</TR>\n";                  
}

echo "</TABLE>\n";                     
?>

</tr >
</td>
</table>

</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="www.mvm-parisot.com"><img src="parisot3.JPG" width="83" height="82" border="0"></a>
</p>
<tr>
<td width=158 heigh=173>
</td>
</tr>
<table>
</body>
</html>
De plus, je te déconseille les url local(C:\...). Mets plutot le chemin relatif à partir de ton script ;)

Posté : 08 juil. 2005, 17:55
par fab
petite remarque au passage , les balises en html comme en xhtml ça doit etre un minuscules :)

Posté : 08 juil. 2005, 22:48
par Cyrano
petite remarque au passage , les balises en html comme en xhtml ça doit etre un minuscules :)
En minuscule, c'est obligatoire en XHTML, mais en html4, on peut tout à fait les mettre en majuscule, c'est valide.

Posté : 11 juil. 2005, 09:09
par lefox88500
merci pour cette reponse mais le probleme est que la taille du texte alors je me retrouve avec une page mega grande en largeuur lol

pourriez vous maider

Posté : 12 juil. 2005, 14:27
par lefox88500
apparement si on iinsert du php comme sa dans un tableau html la taille du tableau agrandi en fonction du texte a faire verifier