Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'PHP iCalendar' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
PHP iCalendar
Authored by: urpaign on Feb 04, '05 11:11:58AM

If you know a bit about PHP, check out PHP iCalendar ( It comes bundled with several prebuilt calendar views, but you can tweak them to no end, or start from scratch and code your own in PHP. I've found this extremely useful (and no, I'm not affiliated with them in any way).

Eg, one of my views is just the plain text info for every event in the next 30 days, which I sync to my iPod notes folder. This gives me much faster access to my info than the iPod calendar view....

[ Reply to This | # ]
PHP iCalendar code sample
Authored by: urpaign on Oct 30, '05 07:41:51PM

I've had several people ask me about this plain text schedule via PHP iCalendar, so posting it here seemed appropriate. This is probably full of hacks and security holes since I'm no PHP expert, but it works for me. Use at your own risk (or clean it up and repost if you are a PHP expert...).


define('BASE', './');

$event_count = 0;
$unix_time = strtotime("$getdate");

$print_title = localizeDate ($dateFormat_month, strtotime($getdate));
$this_day = date("d", strtotime("+0 day", $unix_time)); // or maybe "e" instead of "d"
$this_month = date("Ym", strtotime("+0 month", $unix_time));
$next_month = date("Ym", strtotime("+1 month", $unix_time));

$zero_events = $no_events_month_lang;

//echo "$print_titlen";

// Iterate the entire master array
foreach($master_array as $key => $val) {
	// Pull out only this months
	ereg ("([0-9]{6})([0-9]{2})", $key, $regs);
	// Print *future* events from this month and next
	if ((($regs[1] == $this_month) && ($regs[2] >= $this_day)) || ($regs[1] == $next_month)) {
		$dayofmonth = strtotime ($key);
		$dayofmonth = localizeDate ($dateFormat_day, $dayofmonth);
		echo "$dayofmonthn";
		// Pull out each day
		foreach ($val as $new_val) {
			// Pull out each time
			foreach ($new_val as $new_key2 => $new_val2) {
			if ($new_val2["event_text"]) {	
				$event_text 	= stripslashes(urldecode($new_val2["event_text"]));
				$description 	= stripslashes(urldecode($new_val2["description"]));
				$event_start 	= $new_val2["event_start"];
				$event_end 		= $new_val2["event_end"];
				$event_start 	= date ($timeFormat, strtotime ("$event_start"));
				$event_end 		= date ($timeFormat, strtotime ("$event_end"));
				$event_start 	= "$event_start - $event_end";
				if (!$new_val2["event_start"]) { 
					$event_start = "$all_day_lang";
					$event_start2 = '';
					$event_end = '';
				echo "* $event_start: $event_text";
					if ($new_val2["description"]) {
					echo " ($description)";
				echo "n";
		echo "n";

if ($event_count < 1) {
	echo "$zero_eventsn";


Good luck!

[ Reply to This | # ]