begin process at 2008 08 20 12:39:11
1 228 823 membres
193 nouveaux aujourd'hui
14 257 membres club

Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum.
Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

CALENDRIER TOUT SIMPLE


Information sur la source

Catégorie :Date / Heure Classé sous : calendar, calendrier Niveau : Débutant Date de création : 06/03/2004 Date de mise à jour : 06/03/2004 18:48:12 Vu : 6 010

Note :
8,17 / 10 - par 6 personnes
8,17 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

Commentaire sur cette source (7)
Ajouter un commentaire et/ou une note

Description

Voici un petit calendrier tout simple pour apprendre comment en faire un ! (ouh la digne de freude lol)

Tout est en dessous !

Source

  • <html>
  • <head>
  • </title>Calendrier</title>
  • <style type="text/css">
  • .gestion-calendar {
  • width: 203px;
  • border: 1px solid #000000;
  • background-color: #FFFFFF;
  • }
  • .gestion-calendar-month {
  • border-bottom: 1px solid #000000;
  • background-color: #F0E68C;
  • font-family: Helvetica;
  • font-size: 11pt;
  • font-weight: bold;
  • text-align: center;
  • vertical-align: middle;
  • color: #000000;
  • }
  • .gestion-calendar-day {
  • width: 25px;
  • height: 25px;
  • background-color: #F6F6F6;
  • font-family: Helvetica;
  • font-size: 10pt;
  • font-weight: normal;
  • text-align: center;
  • vertical-align: middle;
  • margin: 0px;
  • padding: 0px;
  • }
  • .gestion-calendar-today {
  • width: 25px;
  • height: 25px;
  • background-color: #F0E68C;
  • font-family: Helvetica;
  • font-size: 10pt;
  • font-weight: normal;
  • text-align: center;
  • vertical-align: middle;
  • margin: 0px;
  • padding: 0px;
  • }
  • .gestion-calendar-dayname {
  • width: 25px;
  • height: 25px;
  • background-color: #F6F6F6;
  • font-family: Helvetica;
  • font-size: 10pt;
  • font-weight: bold;
  • text-align: center;
  • vertical-align: middle;
  • margin: 0px;
  • padding: 0px;
  • }
  • .gestion-calendar-date {
  • text-align: center;
  • vertical-align: middle;
  • padding: 3px;
  • }
  • </style>
  • </head>
  • <body>
  • <?php
  • $bixestile = (date("L")) ? 1 : 0;
  • $nb_jours = date("t");
  • $mois = (int) date("n");
  • $nb_jours = ($mois == 2) ? $nb_jours + $bixestile : $nb_jours;
  • $compteur = 1;
  • $debut = 1;
  • $depart = date("w", mktime(0, 0, 0, $mois, 1, date("Y")));
  • if ($depart == 0) { $depart = 7; }
  • for ($l=1; $l<7; $l++) {
  • for ($c=1; $c<8; $c++) {
  • if ($debut >= $depart) {
  • if ($compteur <= $nb_jours) {
  • if ($compteur == (int) date("d")) {
  • $Day[$l][$c] = '<td class="gestion-calendar-today">'.$compteur.'</td>';
  • } else {
  • $Day[$l][$c] = '<td class="gestion-calendar-day">'.$compteur.'</td>';
  • }
  • } else {
  • $Day[$l][$c] = '<td class="gestion-calendar-day">&nbsp;</td>';
  • }
  • $compteur++;
  • } else {
  • $Day[$l][$c] = '<td class="gestion-calendar-day">&nbsp;</td>';
  • }
  • $debut++;
  • }
  • }
  • $jsem = date("w", time());
  • $jmois = date("j", time());
  • $mois = date("n", time());
  • $annee = date("Y", time());
  • $tabjour=array("Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi");
  • $tabmois=array("0", "janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre");
  • $aujourdhui = $tabjour[$jsem]." $jmois ".$tabmois[$mois]." $annee";
  • ?>
  • <table border="0" cellpadding="0" cellspacing="2" align="center" class="gestion-calendar">
  • <tr>
  • <td class="gestion-calendar-month" colspan="7"><?php echo $tabmois[$mois]." ".date("Y"); ?></td>
  • </tr>
  • <tr>
  • <td class="gestion-calendar-dayname">Lu</td>
  • <td class="gestion-calendar-dayname">Ma</td>
  • <td class="gestion-calendar-dayname">Me</td>
  • <td class="gestion-calendar-dayname">Je</td>
  • <td class="gestion-calendar-dayname">Ve</td>
  • <td class="gestion-calendar-dayname">Sa</td>
  • <td class="gestion-calendar-dayname">Di</td>
  • </tr>
  • <tr>
  • <?php echo @$Day[1][1]; ?>
  • <?php echo @$Day[1][2]; ?>
  • <?php echo @$Day[1][3]; ?>
  • <?php echo @$Day[1][4]; ?>
  • <?php echo @$Day[1][5]; ?>
  • <?php echo @$Day[1][6]; ?>
  • <?php echo @$Day[1][7]; ?>
  • </tr>
  • <tr>
  • <?php echo @$Day[2][1]; ?>
  • <?php echo @$Day[2][2]; ?>
  • <?php echo @$Day[2][3]; ?>
  • <?php echo @$Day[2][4]; ?>
  • <?php echo @$Day[2][5]; ?>
  • <?php echo @$Day[2][6]; ?>
  • <?php echo @$Day[2][7]; ?>
  • </tr>
  • <tr>
  • <?php echo @$Day[3][1]; ?>
  • <?php echo @$Day[3][2]; ?>
  • <?php echo @$Day[3][3]; ?>
  • <?php echo @$Day[3][4]; ?>
  • <?php echo @$Day[3][5]; ?>
  • <?php echo @$Day[3][6]; ?>
  • <?php echo @$Day[3][7]; ?>
  • </tr>
  • <tr>
  • <?php echo @$Day[4][1]; ?>
  • <?php echo @$Day[4][2]; ?>
  • <?php echo @$Day[4][3]; ?>
  • <?php echo @$Day[4][4]; ?>
  • <?php echo @$Day[4][5]; ?>
  • <?php echo @$Day[4][6]; ?>
  • <?php echo @$Day[4][7]; ?>
  • </tr>
  • <tr>
  • <?php echo @$Day[5][1]; ?>
  • <?php echo @$Day[5][2]; ?>
  • <?php echo @$Day[5][3]; ?>
  • <?php echo @$Day[5][4]; ?>
  • <?php echo @$Day[5][5]; ?>
  • <?php echo @$Day[5][6]; ?>
  • <?php echo @$Day[5][7]; ?>
  • </tr>
  • <tr>
  • <?php echo @$Day[6][1]; ?>
  • <?php echo @$Day[6][2]; ?>
  • <?php echo @$Day[6][3]; ?>
  • <?php echo @$Day[6][4]; ?>
  • <?php echo @$Day[6][5]; ?>
  • <?php echo @$Day[6][6]; ?>
  • <?php echo @$Day[6][7]; ?>
  • </tr>
  • <tr>
  • <td class="gestion-calendar-date" colspan="7">Aujourd'hui nous sommes le <?php echo $aujourdhui; ?>. Il est <?php echo date("H")."h".date("i"); ?>.</td>
  • </tr>
  • </table>
  • </body>
  • </html>
<html>
<head>
</title>Calendrier</title>
<style type="text/css">

.gestion-calendar {
	width: 203px;
	border: 1px solid #000000;
	background-color: #FFFFFF;
}

.gestion-calendar-month {
	border-bottom: 1px solid #000000;
	background-color: #F0E68C;
	font-family: Helvetica;
	font-size: 11pt;
	font-weight: bold;
	text-align: center;
	vertical-align: middle;
	color: #000000;
}

.gestion-calendar-day {
	width: 25px;
	height: 25px;
	background-color: #F6F6F6;
	font-family: Helvetica;
	font-size: 10pt;
	font-weight: normal;
	text-align: center;
	vertical-align: middle;
	margin: 0px;
	padding: 0px;
}

.gestion-calendar-today {
	width: 25px;
	height: 25px;
	background-color: #F0E68C;
	font-family: Helvetica;
	font-size: 10pt;
	font-weight: normal;
	text-align: center;
	vertical-align: middle;
	margin: 0px;
	padding: 0px;
}

.gestion-calendar-dayname {
	width: 25px;
	height: 25px;
	background-color: #F6F6F6;
	font-family: Helvetica;
	font-size: 10pt;
	font-weight: bold;
	text-align: center;
	vertical-align: middle;
	margin: 0px;
	padding: 0px;
}

.gestion-calendar-date {
	text-align: center;
	vertical-align: middle;
	padding: 3px;
}

</style>
</head>
<body>
		<?php
			$bixestile = (date("L")) ? 1 : 0;
			$nb_jours = date("t");
			$mois = (int) date("n");
			$nb_jours = ($mois == 2) ? $nb_jours + $bixestile : $nb_jours;
			$compteur = 1;
			$debut = 1;
			$depart = date("w", mktime(0, 0, 0, $mois, 1, date("Y")));
			if ($depart == 0) { $depart = 7; }
			for ($l=1; $l<7; $l++) {
				for ($c=1; $c<8; $c++) {
					if ($debut >= $depart) {
						if ($compteur <= $nb_jours) {
							if ($compteur == (int) date("d")) {
								$Day[$l][$c] = '<td class="gestion-calendar-today">'.$compteur.'</td>';
							} else {
								$Day[$l][$c] = '<td class="gestion-calendar-day">'.$compteur.'</td>';
							}
						} else {
							$Day[$l][$c] = '<td class="gestion-calendar-day">&nbsp;</td>';
						}
						$compteur++;
					} else {
						$Day[$l][$c] = '<td class="gestion-calendar-day">&nbsp;</td>';
					}
					$debut++;
				}
			}
			$jsem = date("w", time());
			$jmois = date("j", time());
			$mois = date("n", time());
			$annee = date("Y", time());
			$tabjour=array("Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi");
			$tabmois=array("0", "janvier", "février", "mars", "avril", "mai", "juin", "juillet", "août", "septembre", "octobre", "novembre", "décembre");
			$aujourdhui = $tabjour[$jsem]." $jmois ".$tabmois[$mois]." $annee";
		?>
		<table border="0" cellpadding="0" cellspacing="2" align="center" class="gestion-calendar">
			<tr>
				<td class="gestion-calendar-month" colspan="7"><?php echo $tabmois[$mois]." ".date("Y"); ?></td>
			</tr>
			<tr>
				<td class="gestion-calendar-dayname">Lu</td>
				<td class="gestion-calendar-dayname">Ma</td>
				<td class="gestion-calendar-dayname">Me</td>
				<td class="gestion-calendar-dayname">Je</td>
				<td class="gestion-calendar-dayname">Ve</td>
				<td class="gestion-calendar-dayname">Sa</td>
				<td class="gestion-calendar-dayname">Di</td>
			</tr>
			<tr>
				<?php echo @$Day[1][1]; ?>
				<?php echo @$Day[1][2]; ?>
				<?php echo @$Day[1][3]; ?>
				<?php echo @$Day[1][4]; ?>
				<?php echo @$Day[1][5]; ?>
				<?php echo @$Day[1][6]; ?>
				<?php echo @$Day[1][7]; ?>
			</tr>
			<tr>
				<?php echo @$Day[2][1]; ?>
				<?php echo @$Day[2][2]; ?>
				<?php echo @$Day[2][3]; ?>
				<?php echo @$Day[2][4]; ?>
				<?php echo @$Day[2][5]; ?>
				<?php echo @$Day[2][6]; ?>
				<?php echo @$Day[2][7]; ?>
			</tr>
			<tr>
				<?php echo @$Day[3][1]; ?>
				<?php echo @$Day[3][2]; ?>
				<?php echo @$Day[3][3]; ?>
				<?php echo @$Day[3][4]; ?>
				<?php echo @$Day[3][5]; ?>
				<?php echo @$Day[3][6]; ?>
				<?php echo @$Day[3][7]; ?>
			</tr>
			<tr>
				<?php echo @$Day[4][1]; ?>
				<?php echo @$Day[4][2]; ?>
				<?php echo @$Day[4][3]; ?>
				<?php echo @$Day[4][4]; ?>
				<?php echo @$Day[4][5]; ?>
				<?php echo @$Day[4][6]; ?>
				<?php echo @$Day[4][7]; ?>
			</tr>
			<tr>
				<?php echo @$Day[5][1]; ?>
				<?php echo @$Day[5][2]; ?>
				<?php echo @$Day[5][3]; ?>
				<?php echo @$Day[5][4]; ?>
				<?php echo @$Day[5][5]; ?>
				<?php echo @$Day[5][6]; ?>
				<?php echo @$Day[5][7]; ?>
			</tr>
			<tr>
				<?php echo @$Day[6][1]; ?>
				<?php echo @$Day[6][2]; ?>
				<?php echo @$Day[6][3]; ?>
				<?php echo @$Day[6][4]; ?>
				<?php echo @$Day[6][5]; ?>
				<?php echo @$Day[6][6]; ?>
				<?php echo @$Day[6][7]; ?>
			</tr>
			<tr>
				<td class="gestion-calendar-date" colspan="7">Aujourd'hui nous sommes le <?php echo $aujourdhui; ?>. Il est <?php echo date("H")."h".date("i"); ?>.</td>
			</tr>
		</table>
</body>
</html>

Conclusion

Bon ce n'est pas la lune mais ca donne la date et l'heure :)
  • signaler à un administrateur
    Commentaire de stanilou le 07/11/2004 16:20:34

    trop beau, trop bien fait !!! 9/10 !!!!

  • signaler à un administrateur
    Commentaire de stanilou le 07/11/2004 16:27:24

    ah si juste un petit bug!
    remplace "</title>Calendrier</title>" par "<title>Calendrier</title>" ca marchera mieux!

  • signaler à un administrateur
    Commentaire de romalafrite le 18/11/2004 21:32:14

    C'est un peu bourrin mais si vous voulez ne pas faire apparaître la dernière ligne lorsqu'il n'y a rien dedans, faites ceci :

    <?php
                if($Day[6][1] !='<td class="gestion-calendar-day">&nbsp;</td>' && $Day[6][2] !='<td class="gestion-calendar-day">&nbsp;</td>' && $Day[6][3] !='<td class="gestion-calendar-day">&nbsp;</td>' && $Day[6][4] !='<td class="gestion-calendar-day">&nbsp;</td>' && $Day[6][5] !='<td class="gestion-calendar-day">&nbsp;</td>' && $Day[6][6] !='<td class="gestion-calendar-day">&nbsp;</td>' && $Day[6][7]!='<td class="gestion-calendar-day">&nbsp;</td>') {
                ?>
                <tr>
                    <?php echo @$Day[6][1]; ?>
                    <?php echo @$Day[6][2]; ?>
                    <?php echo @$Day[6][3]; ?>
                    <?php echo @$Day[6][4]; ?>
                    <?php echo @$Day[6][5]; ?>
                    <?php echo @$Day[6][6]; ?>
                    <?php echo @$Day[6][7]; ?>
                </tr>
             <?php
             }
             ?>

    Bon script ;)

  • signaler à un administrateur
    Commentaire de romalafrite le 18/11/2004 21:33:16

    Je viens de penser, pour faire moins bourrin, vous mettez

    '<td class="gestion-calendar-day">&nbsp;</td>'

    dans une variable ;)

  • signaler à un administrateur
    Commentaire de BaubeGarlo le 21/04/2005 16:41:26

    si je veut ke le dimanche sois le premier jour de la semaine comment je fais ?

  • signaler à un administrateur
    Commentaire de stephgphy le 03/05/2005 09:18:20

    Un ptit calendrier tout joil, tout fonctionnel, 10/10 !!!

  • signaler à un administrateur
    Commentaire de euhreux le 20/10/2005 02:32:06

    Bonjour tous monde, je suis à ma toute premiere fois sur ce Site internet, je suis bien content d'apprendre avec vous!

    maintenant les choses sérieuses, j'aime bien ce super Calendrier, mais est-ce qu'il serait possible de lui faire affiche un autre mois que celui de la date présente? quelqu'un à une idée pour moi?

    Merci de m'aider !

    Philip

Ajouter un commentaire

Discussions en rapport avec ce code source

Pub



Appels d'offres

CalendriCode

Août 2008
LMMJVSD
    123
45678910
11121314151617
18192021222324
25262728293031

Téléchargements

Logiciels à télécharger sur le même thème :

Boutique

Boutique de goodies CodeS-SourceS