Foros del Web » Programando para Internet » PHP »

Conectar Calendario y Noticias

Estas en el tema de Conectar Calendario y Noticias en el foro de PHP en Foros del Web. El problema que tengo es que quiero conectar el sig. sistema de noticias a un calendario, en este se marcarian los dias en los cuales ...
  #1 (permalink)  
Antiguo 11/09/2005, 19:32
Avatar de rigtersir  
Fecha de Ingreso: enero-2004
Ubicación: Mexico City
Mensajes: 28
Antigüedad: 22 años, 8 meses
Puntos: 0
Exclamación Conectar Calendario y Noticias

El problema que tengo es que quiero conectar el sig. sistema de noticias a un calendario, en este se marcarian los dias en los cuales se publico alguna noticia y al dar click en el dia apareciera solo la noticia.

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`)
); 
show.php que muestra las noticias
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);

?>
calendario.php
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[] = '&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>
<?
$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;

?>
__________________
° Rigter °
Portfolio & Blog
http://www.rigtersir.com
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:42.