Forum-webmaster
Technique - programmation => PHP / MySQL => Message commencé par: FOTOTEK le le 26-11-2008 a 10:20:41

Titre: [aide] pb de jour dans calendrier php
Posté par: FOTOTEK le le 26-11-2008 a 10:20:41

Bonjour la communauté ;)

J'ai un problème nouveau sur un calendrier (c'est à dire qu'avant ça marchait normalement). J'ai un décalage de jour de semaine mais la date est bonne. C'est à dire qu'aujourd'hui on est le Mercredi 26 novembre et le calendrier m'affiche le Mardi 26 novembre. J'ai beau chercher, je ne vois pas le "bug".

Voici mon code :

<?php
setlocale (LC_TIME, "fr_FR");
if(!$mois && !$annee){
$mois = date("n");
$annee=date("Y");}
if($mois<1){$mois=12;$annee--;}
if($mois>12){$mois=1;$annee++;}
$n=(is_double($annee/4)) ? 0 : 1 ;
$jmois=array(0,31,28+$n,31,30,31,30,31,31,30,31,30,31);
echo "<center><table border='0' width='230' bordercolor='#47362e' align='center' cellpadding='2' cellspacing='2' bgcolor='white'><tr>";
echo "<td colspan='1' align='left' width='27'><a href=\"../calendar/cal_aff/cal1aff.php3?mois=",$mois-1,"&annee=",$annee,"\"><img src='pyrenees/precsm.gif' width='25' height='14' style='border:none;margin:0;padding:0'></a></td>\n";
echo "<td bgcolor='#47362e' border='1' bordercolor='#47362E' colspan='5' align='center' style='color:#ffffff'><strong><font color='#ffffff' face='Verdana, Arial, Helvetica, sans-serif' size=+2>",ucfirst(strftime('%B %Y', mktime (0,0,0, $mois,1, $annee))),"</font></strong></td>\n";
echo "<td width='27' colspan='1' align='right'><a href=\"../calendar/cal_aff/cal1aff.php3?mois=",$mois+1,"&annee=",$annee,"\"><img src='pyrenees/suivsm.gif' width='25' height='14' style='border:none;margin:0;padding:0'></a></td>\n</tr>";
$y=0;
echo "<tr align='center' bgcolor='#715f4f'><td align='center' width='27' bordercolor='#f7eee9'><font color='#F7EEE9'>Lun</font></td><td align='center' width='27' bordercolor='#f7eee9'><font color='#f7eee9'>Mar</font></td><td align='center' width='27' bordercolor='#f7eee9'><font color='#f7eee9'>Mer</font></td>";
echo "<td align='center' width='27' bordercolor='#f7eee9'><font color='#f7eee9'>Jeu</font></td><td align='center' width='27' bordercolor='#f7eee9'><font color='#f7eee9'>Ven</font></td><td align='center' bordercolor='#f7eee9' width='27'><font color='#f7eee9'>Sam</font></td><td align='center' width='27' bordercolor='#f7eee9'><font color='#f7eee9'>dim</font></td></tr>";
$n=strftime("%w",mktime (0,0,0,$mois,$i,$annee));
for($i=1;$i<$n+1;$i++){echo "<td></td>";$y++;}
for($i=1; $i<$jmois[$mois]+1; $i++){
if($y==7){
echo "</tr><tr>";
$y=0;
}

$day= strftime("%a",mktime (0,0,0,$mois,$i,$annee));
if($day=="dim."){$bg='#e0ccbb';}else{$bg='#e0ccbb';}
$str="../calendar/notes/".$i.$mois.$annee.".txt";
if(file_exists($str) && $fp=fopen($str,"r")){
$txt=file($str);
$bg=trim($txt[0]);
}
if($i==date("d") && $mois==date("m") && $annee==date("Y")){$color=trim($txt[0]);$bg="#ffff66";}
echo "<td bgcolor='$bg'><a href='#' onclick=\"window.open('../calendar/cal_aff/cal_jouraff.php3?jour=",$i,"&mois=",$mois,"&annee=",$annee,"','','width=350,height=450')\">",$i,"</a></td>\n";
$y++;}
echo "</tr></table></center>";
?>

Je remercie d'avance ceux qui voudront me filer un coup de main (pour info et voir le calendrier dans le site : www.isardmourtis.com (http://www.isardmourtis.com))

Titre: Re:[aide] pb de jour dans calendrier php
Posté par: ToToMaStEr le le 28-11-2008 a 17:55:08

Illisible ton code essaye l'indentation...


Forum-webmaster | Actionné par YaBB SE
© 2001-2003, YaBB SE Dev Team. Tous droits réservés.