PHP Calendar

February 3, 2010 at 12:59:43
Specs: Windows XP, 80/120
I'm hoping someone with some PHP Calendar experience can help me.

We have a webpage which is displaying some data from a server using XML. I didn't make this page, and I'm trying to figure out how it was done so I can make edits to it. The page looks like HTML when I view "Source", but upon logging in to the webhost, the files are all .xml and there's what looks like an .xml css. So, I guess this means it is NOT an html page after all, but an .xml page with a css.

What we would like to do, is to have a Calendar, with clickable days, which hyperlink to another page (which is really an .xml file).

What we have now is one page (.xml) showing an ongoing list of files. There is a file (an .xml file) for each day. These files are titled 010510.xml (to mean January 5th, 2010, and so on).

What we'd like is for the one page to have a calendar on it, and the user could click the day they are interested in. This would bring up the xml file for that day.

Is this possible? Should I be looking into PHP Calendar or something else? Javascript? I don't even know where to begin....

See More: PHP Calendar

Report •

February 28, 2010 at 20:02:28
For a PHP calendar, have you tried something similar like this below?

function calendar($date)

if($date == null)
$date = getDate();

$day = $date["mday"];
$month = $date["mon"];
$month_name = $date["month"];
$year = $date["year"];

$this_month = getDate(mktime(0, 0, 0, $month, 1, $year));
$next_month = getDate(mktime(0, 0, 0, $month + 1, 1, $year));
$first_week_day = $this_month["wday"];
$days_in_this_month = round(($next_month[0] - $this_month[0]) / (60 * 60 * 24));

$calendar_code= "<table style=\"background-color:0099CC; color:EBEAE7;\">";

$calendar_code .= "<tr><td colspan=\"7\" align=\"center\" style=\"background-color:B5B1A6; color:1B1B1B;\">" .
$month_name . " " . $year . "</td></tr>";

$calendar_code .= "<tr>";

for($week_day = 0; $week_day < $first_week_day; $week_day++)
$calendar_code .= "<td style=\"background-color:B5B1A6; color:1B1B1B;\"> </td>";

$week_day = $first_week_day;
for($day_counter = 1; $day_counter <= $days_in_this_month; $day_counter++)
$week_day %= 7;

if($week_day == 0)
$calendar_code .= "</tr><tr>";

if($day == $day_counter)
$calendar_code .= "<td align=\"center\">" . $day_counter . "</td>";
$calendar_code .= "<td align=\"center\" style=\"background-color:B5B1A6; color:000000;\"> " .
$day_counter . " </td>";


$calendar_code .= "</tr>";
$calendar_code .= "</table>";


Report •
Related Solutions

Ask Question