Calendrier événement php
vincent62120
Messages postés
16
Statut
Membre
-
vincent62120 Messages postés 16 Statut Membre -
vincent62120 Messages postés 16 Statut Membre -
Bonjour,
Je suis actuellement en stage et je dois réaliser un site pour l'administrateur avec un calendrier ou il pourra noter une 10aine d'événements en cliquant sur le jour.
J'ai trouvé ce script sur le net :
mais je n'arrive pas à voir le résultat sur mon site. J'ai pourtant une url qui me semble correct : http://localhost:45xxx/calendrier.php
mais j'obtiens une page blanche.
Quelqu'un pour m'aider ?
Je suis actuellement en stage et je dois réaliser un site pour l'administrateur avec un calendrier ou il pourra noter une 10aine d'événements en cliquant sur le jour.
J'ai trouvé ce script sur le net :
<?php
function calendrier(){
$mois = array('', 'Janvier', 'Février', 'Mars', 'Avril', 'Mai',
'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre');
$month=@(($_GET['mois']<=12)&&($_GET['mois']>=1))?$_GET['mois']:date('m');
$year=@(ctype_digit($_GET['annee']))?$_GET['annee']:date('Y');
$test=(($month==date('m'))&&($year==date('Y')));
$jour=date('j');
$first = mktime(0, 0, 0, $month, 1,$year);
$nombre = date("t", $first);
$debut = date("w", $first);
?>
<div class="cal-aff">
<?php
if($month-1==0){
$amonth=12;
$ayear=$year-1;
}else{
$amonth=$month-1;
$ayear=$year;
}
?>
<a href="?mois=<?=$amonth?>&annee=<?=$ayear?>"><-</a>
<?=($mois[intval($month)].' '.$year)?>
<?php
if($month+1==13){
$amonth=1;
$ayear=$year+1;
}else{
$amonth=$month+1;
$ayear=$year;
}
?>
<a href="?mois=<?=$amonth?>&annee=<?=$ayear?>">-></a>
</div>
<table class="calendrier">
<tr class="cal-head">
<th class="cal-jour">L</th>
<th class="cal-jour">M</th>
<th class="cal-jour">M</th>
<th class="cal-jour">J</th>
<th class="cal-jour">V</th>
<th class="cal-jour">S</th>
<th class="cal-jour">D</th>
</tr>
<tr>
<?php
for($n=1;$n<$debut;$n++){
echo "<td></td>\n";
}
$n= ($debut!=0)?$debut:1;
for($i=1;$i<=$nombre;$i++){
$m=($i<10)?'0':'';
$p=(($test)&&($jour==$i))?' class="today"':'';
echo "<td$p>$m$i</td>\n";
if($n==7 && $i!=$nombre){
echo "</tr><tr>\n";
$n=0;
}
$n++;
}
?>
</tr>
</table>
<form method="get" class="submit">
<select name="mois">
<?php
for($n=1;$n<=12;$n++){
$m=($n<10)?'0':'';
?>
<option value="<?=$m.$n?>" <?php if ($month == $n) echo 'selected="selected"' ?>><?=$mois[$n]?></option>
<?php
}
?>
</select>
<select name="annee">
<?php
$y=date('Y');
for($i=$y-3;$i<=$y+3;$i++){
echo '<option value="'.$i.'"';
if($i==$year)
echo ' selected="selected"';
echo '>'.$i.'</option>';
}
?>
</select>
<input type="submit" />
</form>
<?php
}
?>
<style type="text/css">
.today{color:red;font-weight:bold;}
.calendrier{width:200px;height:0px;}
.cal-head{background-color:blue;}
.submit,.cal-aff{width:200px;text-align:center;}
</style>
</head><body>
<?php
require('cal.php');
calendrier();
?>
mais je n'arrive pas à voir le résultat sur mon site. J'ai pourtant une url qui me semble correct : http://localhost:45xxx/calendrier.php
mais j'obtiens une page blanche.
Quelqu'un pour m'aider ?
A voir également:
- Calendrier événement php
- Mon calendrier - Télécharger - Santé & Bien-être
- Logiciel gratuit conversion calendrier républicain - Télécharger - Études & Formations
- Calendrier partagé google - Guide
- Synchroniser calendrier outlook et gmail - Guide
- Easy php - Télécharger - Divers Web & Internet
3 réponses
Il s'agit bien du contenu de 2 fichiers, c'est bien ça ?
- Un fichier "cal.php" contenant la définition de la fonction "calendrier"
- Un autre fichier PHP appelant cette fonction
Le contenu du 2 nd fichier serait donc :
<style type="text/css">
.today{color:red;font-weight:bold;}
.calendrier{width:200px;height:0px;}
.cal-head{background-color:blue;}
.submit,.cal-aff{width:200px;text-align:center;}
</style>
<?php
require('cal.php');
calendrier();
?>
- Un fichier "cal.php" contenant la définition de la fonction "calendrier"
- Un autre fichier PHP appelant cette fonction
Le contenu du 2 nd fichier serait donc :
<style type="text/css">
.today{color:red;font-weight:bold;}
.calendrier{width:200px;height:0px;}
.cal-head{background-color:blue;}
.submit,.cal-aff{width:200px;text-align:center;}
</style>
<?php
require('cal.php');
calendrier();
?>