Aqui les dejo el code del sistema, ojala alguien me pudiera ayudar a conectar el calendario con mi sistema de noticias.
La Tabla News
Código PHP:
CREATE TABLE `news` (
`id` int(9) NOT NULL auto_increment,
`titulo` varchar(100) NOT NULL default '',
`fecha` varchar(100) NOT NULL default '',
`mensaje` longtext NOT NULL,
KEY `id` (`id`)
);
Código PHP:
<?php
include("config.php");
$query = mysql_query("SELECT * FROM news ORDER BY id DESC LIMIT 15");
while($row = mysql_fetch_array($query)){
echo "<div align=center>
<center>
<table border=\"1\" cellpadding=\"3\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"80%\" id=\"AutoNumber1\">
<tr>
<td width=\"100%\">
<div align=\"center\">
<center>
<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"100%\" id=\"AutoNumber1\">
<tr>
<td width=\"100%\">$row[titulo]</td>
</tr>
<tr>
<td width=\"100%\">$row[fecha]</td>
</tr>
<tr>
<td width=\"100%\">$row[mensaje]</td>
</tr>
<tr>
<td width=\"100%\">
<p align=\"center\">Comentarios | Enlace Permanente</td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
</center></div><br>";
}
mysql_close($link);
?>
Código PHP:
<?
$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 = 7 - $dayWeek;
$start = ($dayWeek == 0) ? false : true;
if ($v < 7) {
$m = 1;
$preDays2Use = array_filter($days2Use,'splitDays');
/*preparamos para mostrar*/
$rest = 7 - count($preDays2Use);
$fDays2Use = array();
for ($y = 1; $y <= $rest; $y++) $fDays2Use[] = ' ';
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) : " "?></td><?
next($days2Use);
}
?></tr><?
}
?></table><br>
<?
$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;
?>