par
rspir » 17 mai 2006, 15:40
En fait c'est peut être inutile, mais je fais un incude d'un fichier contenant ceci :
define ("DEFAUT","defaut");
define ("ARC","archive");
define ("INSERT","insertion");
define ("MAJ","maj");
define ("DEL","delete");
define ("LISTCOM","list_com");
define ("LISTARC","list_arc");
Donc je récupère bien ma variable.
Comme dit plus haut, j'ai commencé mon site avec un bouquin, et je me suis inspiré de la méthode décrite. Progressivement j'adapte le code (et j'apprends le PHP) et je nettoie et j'optimise mes fichiers et fonctions.
je pars de loin ... ou plutot de 0.
Ma fonction actuelle donne ceci :
function Tableau ($connexion)
{
$requete = "SELECT id, dcrea, texte, DATE_FORMAT(dcrea, '%d/%m/%y %H:%i') AS 'dcreation',DATE_FORMAT(MAJ, '%d/%m/%y %H:%i') AS 'dmaj' "
. " FROM filinfo"
. " LEFT JOIN refinfo ON filinfo.id = refinfo.idinf"
. " ORDER BY dcrea DESC";
$resultat = ExecRequete ($requete, $connexion);
$num=mysql_num_rows ($resultat);
if ($num < 1)
{
echo "Aucun <span class='i'>i-</span>communiqué publié<br>\n";
}
else
{
echo "<h1>" .$num. ($num ==1 ? ' <span class="i">i-</span>communiqué publié' : ' <span class="i">i-</span>communiqués publiés') ."</h1>";
// . "<center><table border=0 cellspacing=2 cellpadding=2>"
// . "<caption align=bottom>Gestion des <span class='i'>i-</span>communiqués</caption>"
// . "<tr class='titre'><th>Info<th>Création<th>Modif.<th>ref<th colspan='3'>Action</tr>\n";
$i=0;
while ($info = ObjetSuivant($resultat))
{
$i++;
$idURL=urlEncode ($info->id);
?>
<tr class="A<?php echo ($i%2);?>" onMouseOver="this.className='over'" onMouseOut="this.className='A<?php echo ($i%2);?>'">
<td width=450><?php echo $info->texte;?></td>
<td><?php echo $info->dcreation;?></td>
<td><?php echo $info->dmaj;?></td>
<td><input type="checkbox" name="ref[]" value="rae"<?php if($toto=="1") {echo " checked='checked'" ;}?>"/>
<td><a href="_admin.php?mode=<?php echo MAJ?>&id=<?php echo $idURL;?>"><img hspace="2" width="16" height="16" src="./images/b_edit.png" alt="Modifier" title='Modifier" border="0"></a></td>
<td><a href='_admin.php?mode=<?php echo ARC?>&id=<?php echo $idURL;?>"><img hspace="2" width="16" height="16" src="./images/b_tblexport.png" alt="Archiver" title="Archiver" border='0'></a></td>
<td><a href='_admin.php?mode=<?php echo DEL?>&id=<?php echo $idURL;?>"><img hspace="2" width="16" height="16" src="./images/b_drop.png" alt="Supprimer" title="Supprimer" border='0'></a></td>
<?
}
echo "</table></center>\n";
}
}
J'ai encore du boulot ...
En fait c'est peut être inutile, mais je fais un incude d'un fichier contenant ceci :
[php]define ("DEFAUT","defaut");
define ("ARC","archive");
define ("INSERT","insertion");
define ("MAJ","maj");
define ("DEL","delete");
define ("LISTCOM","list_com");
define ("LISTARC","list_arc");[/php]
Donc je récupère bien ma variable.
Comme dit plus haut, j'ai commencé mon site avec un bouquin, et je me suis inspiré de la méthode décrite. Progressivement j'adapte le code (et j'apprends le PHP) et je nettoie et j'optimise mes fichiers et fonctions.
je pars de loin ... ou plutot de 0.
Ma fonction actuelle donne ceci :
[php]function Tableau ($connexion)
{
$requete = "SELECT id, dcrea, texte, DATE_FORMAT(dcrea, '%d/%m/%y %H:%i') AS 'dcreation',DATE_FORMAT(MAJ, '%d/%m/%y %H:%i') AS 'dmaj' "
. " FROM filinfo"
. " LEFT JOIN refinfo ON filinfo.id = refinfo.idinf"
. " ORDER BY dcrea DESC";
$resultat = ExecRequete ($requete, $connexion);
$num=mysql_num_rows ($resultat);
if ($num < 1)
{
echo "Aucun <span class='i'>i-</span>communiqué publié<br>\n";
}
else
{
echo "<h1>" .$num. ($num ==1 ? ' <span class="i">i-</span>communiqué publié' : ' <span class="i">i-</span>communiqués publiés') ."</h1>";
// . "<center><table border=0 cellspacing=2 cellpadding=2>"
// . "<caption align=bottom>Gestion des <span class='i'>i-</span>communiqués</caption>"
// . "<tr class='titre'><th>Info<th>Création<th>Modif.<th>ref<th colspan='3'>Action</tr>\n";
$i=0;
while ($info = ObjetSuivant($resultat))
{
$i++;
$idURL=urlEncode ($info->id);
?>
<tr class="A<?php echo ($i%2);?>" onMouseOver="this.className='over'" onMouseOut="this.className='A<?php echo ($i%2);?>'">
<td width=450><?php echo $info->texte;?></td>
<td><?php echo $info->dcreation;?></td>
<td><?php echo $info->dmaj;?></td>
<td><input type="checkbox" name="ref[]" value="rae"<?php if($toto=="1") {echo " checked='checked'" ;}?>"/>
<td><a href="_admin.php?mode=<?php echo MAJ?>&id=<?php echo $idURL;?>"><img hspace="2" width="16" height="16" src="./images/b_edit.png" alt="Modifier" title='Modifier" border="0"></a></td>
<td><a href='_admin.php?mode=<?php echo ARC?>&id=<?php echo $idURL;?>"><img hspace="2" width="16" height="16" src="./images/b_tblexport.png" alt="Archiver" title="Archiver" border='0'></a></td>
<td><a href='_admin.php?mode=<?php echo DEL?>&id=<?php echo $idURL;?>"><img hspace="2" width="16" height="16" src="./images/b_drop.png" alt="Supprimer" title="Supprimer" border='0'></a></td>
<?
}
echo "</table></center>\n";
}
}[/php]
J'ai encore du boulot ...