Fonctions et fichier include
Posté : 02 août 2005, 23:09
Bonjour,
j'essaye de créer une fonction qui va me générer automatique un cadre "graphique" autour d'un tableau contenu dans un autre fichier:
A votre bon coeur.
Merci
j'essaye de créer une fonction qui va me générer automatique un cadre "graphique" autour d'un tableau contenu dans un autre fichier:
<?
$variable = include("non_du_fichier.php");
cadre($variable);
?>
voici le script de la fonction:<?
function cadre($variable){
echo "<table align='center' width='100%' border='0' cellspacing='0' cellpadding='0'>";
echo "<tr>";
echo "<td width='5' height='7'><img src='Navi/coinHG.gif' width='5' height='7'></td>";
echo "<td background='Navi/barredessus.gif'><img src='Navi/barredessus.gif' height='7' width='100%'></td>";
echo "<td width='5' height='7'><img src='Navi/coinHD.gif' width='5' height='7'></td>";
echo "</tr>";
echo "<tr>";
echo "<td background='Navi/barregauche.gif'><img src='Navi/barregauche.gif' width='5'></td>";
echo "<td bgcolor='#2059A6'>";
echo $variable;
echo "</td>";
echo "<td background='Navi/barredroite.gif'><img src='Navi/barredroite.gif' width='5'></td>";
echo "</tr>";
echo "<tr>";
echo "<td width='5' height='7'><img src='Navi/coinBG.gif' width='5' height='7'></td>";
echo "<td background='Navi/barredessous.gif'><img src='Navi/barredessous.gif' height='7'></td>";
echo "<td width='5' height='7'><img src='Navi/coinBD.gif' width='5' height='7'></td>";
echo "</tr>";
echo "</table>";
}
?>
Je mets le fichier include:<?
echo "<table width='100%' border='0' cellpading='0' cellspacing='0'>";
echo "<tr><td>";
// on récupère les paramétres
$query= "SELECT * FROM $table9";
$resultat= mysql_query ($query);
while ($ligne=mysql_fetch_array($resultat)){
$vitesse = $ligne ["Vitesse"];
$sens = $ligne ["Sens"];
}
echo "<MARQUEE behavior='scroll' direction='$sens' scrolldelay='$vitesse' onmouseover=\"this.stop()\" onmouseout=\"this.start()\">";
// on récupère les messages
$query= "SELECT * FROM $table8 ORDER BY `Ordre` ASC";
$resultat= mysql_query ($query);
while ($ligne=mysql_fetch_array($resultat)){
$message = $ligne ["Message"];
echo "$message<br><br><br><br>";
}
echo "</marquee>";
echo "</tr></td>";
echo "</table>";
?>
à l'affichage j'ai bien le cadre, mais au lieu d'avoir mon texte qui défile j'ai la valeur 1 qui est retournée...A votre bon coeur.
Merci