Welcome Guest, Not a member yet? Register   Sign In
Just a suggestion about calendar!

actually, the calendar class should be the one typecasting, but it doesn't. it assumes numeric array keys are passed to it but doesn't do anything to assure itself that they are numeric. the calendar class is pretty weak as it stands right now - good for quick, basic stuff but not good for a full calendar interface. that is, don't build a calendar interface around the CI calendar class - you will be sorry.

a few things:
• the calendar items are set in an associative array with the day number of the month as the key and a string as data:
// line 223 shows the $data array being accessed by a numerical
// key inside a while loop driven by an incrementor and string replaced into a template
$out .= str_replace('{day}', $day, str_replace('{content}', $data[$day], $temp));

the least tiny change in the calendar class would help avoid making the developer typecast because of the internal design decisions of the calendar class creator. so, something like this would be a little help:
// since we are going to use the numerical incrementor as a key
// we typecast the key in case dev used zero padded string (or other "almost" number as their key
$out .= str_replace('{day}', $day, str_replace('{content}', $data[(int)$day], $temp));

• the calendar does not support days before the start of the current month or days at the end of the month (e.g., sunday the last day of the previous month when the current month starts on a monday OR saturday the 1st of the next month when the current month ends on a friday).

• cannot handle additonal URI segments when using next and prev functions. e.g, if you want to page through months but maintain a "filter" (say a category filter for blog posts) in the URI like domain.com/calendar/2006/03/dogs. it works on the month that is in the original URI but the auto-generated calendar month pager links do not have the additional "dogs" URI segment. this forces you to maintain simple things like that in sessions.

anyhow, enough complaining. good luck on your project.

Messages In This Thread
Just a suggestion about calendar! - by El Forum - 06-24-2007, 09:15 AM
Just a suggestion about calendar! - by El Forum - 06-24-2007, 06:49 PM
Just a suggestion about calendar! - by El Forum - 06-24-2007, 08:44 PM
Just a suggestion about calendar! - by El Forum - 06-24-2007, 09:05 PM

Theme © iAndrew 2016 - Forum software by © MyBB