Page 1 sur 1

test sur une image(fonction)

Posté : 31 mars 2007, 06:22
par x@v
Bonjour,
j'ai une fonction qui m'affiche une table, l'ennui c'est que les lignes qui sont vide m'affiche une le cadre de l'image absente et donc je cherche l'astuce pour ne pas afficher l'image absente si il n'y a rien dans la ligne demander.
http://88.167.164.83/jean-paul/index_xajax.php
function produitvu() {
  $reponse = new xajaxResponse();
  $req="SELECT DISTINCT rubrique FROM pages";
  $query = mysql_query($req);
  $txt = '';
  $txt.='<table id="diaporama">';
  $i=0;
  while($tb = mysql_fetch_assoc($query)){
  if($i%9 == 0)  $txt .= '<tr>';
  $txt .= '<td>';
  $txt .= '<a href="javascript:void(0);" OnClick="xajax_detailvu(\'' . $tb['rubrique'] . '\');">';
  $txt .= '<img src="./conte/'.$tb['rubrique'].'.png" alt="'.$tb['rubrique'].'" style="width:81px;height:64px;border:1px solid black;" onMouseOver="diaporama_bigimg('.($i+1).')" id="diaporama_img_'.($i+1).'" /><br />';
  $txt .='<span id="menu_carte">';
  $txt .= $tb['rubrique'] . '</span></a>';
  $txt .= '</td>';
  if(($i+1%9) == 0)  $txt .= '</tr>';
  $i++;
  }
  $txt .= '</table>';
  $reponse->addAssign("menu_conte", "innerHTML", $txt);
  $reponse->addScriptCall("xajax_date_local");
  $reponse->addScriptCall("xajax_insertion_stat");
  $reponse->addScriptCall("xajax_pied_page");
  return $reponse->getXML();
}
j'ai essayer avec un test sans succès ?
  if (isset($tb['rubrique'])) {
  $txt .= '<img src="./conte/'.$tb['rubrique'].'.png" alt="'.$tb['rubrique'].'" style="width:81px;height:64px;border:1px solid black;" onMouseOver="diaporama_bigimg('.($i+1).')" id="diaporama_img_'.($i+1).'" /><br />';
  $txt .='<span id="menu_carte">';
  $txt .= $tb['rubrique'] . '</span></a>';
  }
Merci

Posté : 31 mars 2007, 08:06
par Expreg
Hip,

EDIT, j'ai rien dit j'ai lu en diagonale !

Posté : 31 mars 2007, 10:02
par Invité
Moi a ce que j'ai compris, essaie un truc comme sa :
if(is_file('ton image')) echo '<img src="ton img" border="0" />';
else echo 'Pas d image disponible';

Posté : 01 avr. 2007, 04:31
par x@v
j'ai fait autrment, le chemin dans la un champs de ma table, merci