Hacks

From PHPicalWiki

Jump to: navigation, search

I didn't see any place to share hacks. I don't know if they're allowed or frowned upon, but on the chance they are OK or even encouraged, I have at least one to share.


Contents

[edit] Full Event Names

I had users complaining that the calendar was of no use to them when printed with the event names truncated. To change this, I edited /functions/draw_functions.php (v 2.0.1) by adding the following new line at line 41 (which is just inside the word_wrap() function):

$length = 100;

I think we cover this in the config, setting event_lines = 0, or is this hack for something else? - Tide

[edit] Dynamically Variable Event Names

I'm experimenting with using Javascript, DOM and CSS to make the event titles nicer. I'm only using the W3C DOM right now, but I think this should be expandable to work on MSIE.

[edit] Display This Month's Events

This is super helpful for people who want to list events in a sleek row format. I've been looking for something like this for a while but the boxy calendar view is not conducive to listing events. This quick edit turns your calendar into an event lister.

Open templates/default/month.tpl in dreamweaver or other WYSWYG editor and in layout view delete everything below "header" and above the obvious "this month's events" variable. Then change the full table width to 100% as opposed to the some 735px it is orginally. You will notice that there is another table just above "Footer" that is set to 735px. It includes spacer images. Delete the entire table. It is not needed for our purposes. Be sure to back up the original file. In your preferences, set "month" as the default. Now you don't even have to link to month.php in order to display as an event lister.

Making these changes also produces a desirable artifact. When the event is click, it opens in a small, properly formatted box that inclues the details of the event. It doesn't get more lucky than this! This is my dream come true. Thanks phpicalendar!

[edit] Extract Next 7 Days' Events From RSS Feed

I wrote up a quick and dirty tutorial on how I extract the next 7 days' events from the RSS feed out of phpiCalendar on my website. I also have an example of this in action on my church's website.

[edit] Remove cancelled events from calendar display

This 'hack' will make PHP iCalendar RFC compiant with relation to cancelled events. When events are cancelled the status of these events is set as "CANCELLED", in accordance with rfc 2445 (the ics RFC)

The problem is that PHP iCalendar displays these events with a small x instead of a check mark.

All of the work was done in template.php, I had to wrap several groups of commands with if-then statements. Basically skipping the cancelled events when displaying the calendars.

The link to the updated template.php file is here

The forum discussion thread is here