Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/07/2005, 14:39
Avatar de rigtersir
rigtersir
 
Fecha de Ingreso: enero-2004
Ubicación: Mexico City
Mensajes: 28
Antigüedad: 20 años, 3 meses
Puntos: 0
Calendario

Aqui te dejo un calendario muy sencillo pero muy util, espero que te sirva de algo.
Código PHP:
<html>
<head>
<title>Calendario</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
th, td {
    font-family: Tahoma, Verdana;
    font-size: 10px;
    font-style: normal;
    line-height: normal;
    font-weight: normal;
    font-variant: normal;
    text-transform: none;
    color: #666666;
    text-decoration: none;
}
td {
    color: #999999;
}
.current{
    font-family: Tahoma, Verdana;
    font-size: 10px;
    color: #666666;
}
-->
</style>
</head>
<body>
<?
$mes 
Date("m");
$anio Date("Y");
$dia Date("d");
$days cal_days_in_month(CAL_GREGORIAN$mes$anio);
$days2Use = array();
for (
$x=1$x<=$days$x++) $days2Use[] = $x;

$jd GregorianToJD($mes,1,$anio);
$dayWeek jddayofweek($jd,0);
/*$v son los primeros DIAS*/
$v $dayWeek;
$start = ($dayWeek == 0) ? false true;

if (
$v 7) {
    
$m 1;
    
$preDays2Use array_filter($days2Use,'splitDays');
    
/*preparamos para mostrar*/
    
$rest count($preDays2Use);
    
$fDays2Use = array();
    for (
$y 1$y <= $rest$y++) $fDays2Use[] = '&nbsp;';
    foreach (
$preDays2Use AS $k => $v$fDays2Use[] = $v;
}
$m 0;
$days2Use array_filter($days2Use,'splitDays');
function 
splitDays($d) {
    global 
$v$start$m;
    
$com = ($m) ? ($d $v) : ($d <= $v);
    if ((
$com) AND ($start)) return false;
    return 
true;
}
$totRestDays count($days2Use);

$pre $totRestDays 7;
if (
$pre == 0$top $totRestDays 7;
else { 
$top = ($totRestDays 7) + 1$top floor($top); }

$spDays = array("Dom","Lun","Mar","Mie","Jue","Vie","Sab");
?>
<table cellpadding="0" cellspacing="2" width="200" border="0" style="text-align: center;">
  <tr height="17">
  <?foreach($spDays AS $dd) echo '<th bgstyle="color:#4069B1" scope="col">'.$dd.'</th>';?>
  </tr>
  <?
if ($v 7) {
    
?><tr><?
    
foreach ($fDays2Use AS $k => $v) echo '<td bgstyle="color:#F0F5FF">'.$v.'</td>';
    
?><tr><?
}
reset($days2Use);
for (
$x 1$x <= $top;$x++) {
    
$bgcolor = ($x 2) ? FFFFFF F0F5FF;
    
?><tr><?
    
for ($p 1$p <= 7;$p++) {
        
?><td bgstyle="color:#<?=$bgcolor?>"><?=(current($days2Use)) ? current($days2Use) : "&nbsp;"?></td><?
        next
($days2Use);
    }
    
?></tr><?
}
?></table><br>
<font class="current">
<?
$nommes 
= array("Enero""Febrero""Marzo""Abril""Mayo""Junio""Julio""Agosto""Septiembre""Octubre""Noviembre""Diciembre");
$nomdia = array("Domingo""Lunes""Martes""Miercoles""Jueves""Viernes""Sabado");
$dia date(j);
$mes date(n);
$diasemana date(w);
$hoy $nomdia[$diasemana]." ".$dia." de ".$nommes[$mes-1]." ".date(Y)."";
echo 
$hoy;

?> </font><br><br>
</body>
</html>
__________________
° Rigter °
Portfolio & Blog
http://www.rigtersir.com