PHP Calendar
I'm looking for a PHP Calendar script to use with my company's intranet. The calendar has to be somewhat customizable as I would like to incorporate the calendar's login with the intranet's login (which is currently PHP/MySQL). I was wondering if anybody has had good luck with a calendar in the past or has any recommendations. Everything I find and like seems to have encrypted code.
Thanks.
andy206uk posted this at 23:47 — 4th February 2005.
He has: 1,758 posts
Joined: Jul 2002
I say this a lot, but it's always better to use a bespoke solution designed specifically for your needs.
Creating a calendar is actually quite easy, simply establish how many days are in a month, then loop through that month for the set number of days. For instance, heres how you do it in PHP. (roughly... its untested so may have code errors... it's late).
<?php
$monthdays = array('01' => '31', '02' => '28', '03' => '31'); //etc
$monthnames = array('01' => 'Jan', '02' => 'Feb'. '03' => 'March');
foreach($monthday as $name => $days) {
echo("<p>$monthnames[$name]</p>");
echo("<table>");
$i = 1;
while ($i <= 10) {
$i++;
echo("<tr><td>$i</td></tr>")
}
echo("</tables>");
}
?>
Of course, you need to take into account leap years and things like that but it's easy enough using a combination of php's mktime and date functions.
Once you have that setup you can link each day to a html file, text file or a page that queries a database for events. Pretty simple huh?
Andy
estebandemuerte posted this at 19:56 — 7th February 2005.
They have: 2 posts
Joined: Feb 2005
Thanks for the help. I just might make my own as you suggested. I was just hoping I could be lazy and avoid it.... But I do appreciate the help and the coding start.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.