2 of 2
2
iCal plugin
Posted: 17 June 2008 11:57 PM   [ Ignore ]   [ # 19 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1909
Joined  01-05-2007

Hi DFBills,

Can you post a fully working template for me to view? You seem to have mixed PHP and XML in one go up there and I’m a little confused as to how to use the code.

 Signature 

 
Steven Hambleton | Follow me on Twitter!


ExpressionEngine Outsourcing for Marketing, Graphic & Web Agencies
Partner with a professional ExpressionEngine development team to turn your designs into functioning sites.

Profile
 
 
Posted: 18 June 2008 06:34 AM   [ Ignore ]   [ # 20 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  117
Joined  11-12-2002

My previous post is the fully working template.  It does seem overly simple, but everything you need is right there.  It is a mix of PHP, EE and of course XML.  Let me run through it for you.

In the first block of PHP, I’m getting the current date in a format I can use and storing as a variable.  Specifically, last month in ‘d-m-Y’ format and next year in ‘d-m-Y’ format.

<?php
// last month in 'd-m-Y' format
$uts['lastmonth'] = strtotime( '-1 months' ); // or, strtotime( 'yesterday' );
$last_month = date( 'Y-m-d g:i A', $uts['lastmonth'] );

// next year in 'd-m-Y' format
$uts['nextyear'] = strtotime( '+1 years' ); // or, strtotime( 'yesterday' );
$next_year = date( 'Y-m-d g:i A', $uts['nextyear'] );
?>

Now, we start into XML as required by the vCal standard.

BEGIN:VCALENDAR
VERSION
:2.0
X
-WR-CALNAME:BMI Event Calendar
PRODID
:-//BMI/ Events//NONSGML v1.0//EN
X-WR-TIMEZONE:US/Eastern

Now, some standard EE code to get weblog data.  Here’s where I use those PHP date variables we grabbed at the beginning to limit the data returned by EE.  My weblog has > 20,000 events listed, so I list one month back and one year forward.

{exp:weblog:entries weblog="events" status="not closed" show_future_entries="yes" disable="member_data|pagination|trackbacks|categories" show_expired="no" orderby="date" sort="asc" start_on="<?php echo $last_month; ?>" stop_before="<?php echo $next_year; ?>" limit="1000"}

This data is wrapped in the proper XML formatting.  On my calendar, I don’t have proper times set in the weblog entries, so I leave them at midnight. (T120001)

BEGIN:VEVENT
UID
:{entry_id}
DTSTAMP
:{entry_date format="%Y%m%dT%H%i%sZ"}
DTSTART
;VALUE=DATE:{entry_date format="%Y%m%d"}T120001
DTEND
;VALUE=DATE:{entry_date format="%Y%m%d"}T120002

Here’s where I had to cleanup the data a bit to conform to the strict vCal spec with my own little vcal_encode plugin.  (vCal doesn’t like extended characters, linebreaks, etc.)

SUMMARY:{exp:vcal_encode}{title}{/exp:vcal_encode}
DESCRIPTION
:{exp:vcal_encode}{long}{/exp:vcal_encode}

Finally, I wrap up the template by closing the vCal file and the EE tags.

END:VEVENT
{
/exp:weblog:entries}
END
:VCALENDAR

Remember that this template must be served from EE as XML and PHP must be enabled for it to work properly.  You may have named fields differently from mine, but you should be able to just plug those right in.

One final tip- I found it very helpful to debug the rendered code using curl at the command line.  On my setup, I just pipe it into TextMate like this:

curl http://www.bmi.com/events/ical | mate
Profile
 
 
Posted: 18 June 2008 06:53 AM   [ Ignore ]   [ # 21 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  218
Joined  02-10-2006
rish - 21 April 2006 03:27 AM

I think we’re going to see all sorts of neat things revolving around Google Calendar real soon, they released a calendar API today and you can subscribe to Google Calendars from iCal.

http://www.google.com/calendar/
http://code.google.com/apis/gdata/calendar.html

Hey Guys,

We are actually in the process of writing a complete module with full Google Calendar support with in integrated template and tagging parameters.

We are going to start testing it out on some sites in the next month.

Brandon

Profile
 
 
Posted: 18 June 2008 06:53 AM   [ Ignore ]   [ # 22 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  117
Joined  11-12-2002

Sounds sweet

Profile
 
 
Posted: 18 June 2008 06:59 AM   [ Ignore ]   [ # 23 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1909
Joined  01-05-2007
bjsteiger - 18 June 2008 06:53 AM
rish - 21 April 2006 03:27 AM

I think we’re going to see all sorts of neat things revolving around Google Calendar real soon, they released a calendar API today and you can subscribe to Google Calendars from iCal.

http://www.google.com/calendar/
http://code.google.com/apis/gdata/calendar.html

Hey Guys,

We are actually in the process of writing a complete module with full Google Calendar support with in integrated template and tagging parameters.

We are going to start testing it out on some sites in the next month.

Brandon

Yes please!

 Signature 

 
Steven Hambleton | Follow me on Twitter!


ExpressionEngine Outsourcing for Marketing, Graphic & Web Agencies
Partner with a professional ExpressionEngine development team to turn your designs into functioning sites.

Profile
 
 
Posted: 08 September 2008 12:56 AM   [ Ignore ]   [ # 24 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  659
Joined  04-23-2006

*woot*

How’s the development of this module coming along?

 Signature 

OLD username was jammo, NEW username is OrganizedFellow

It’s a struggle even to keep focused. This is the best of my AD/HD & GTD.
The exceptionally slow growth of my web dev projects is eclipsed by my patience, understanding and desire to learn AS MUCH AS POSSIBLE as I slowly progress.

Profile
 
 
Posted: 23 November 2008 01:22 PM   [ Ignore ]   [ # 25 ]  
Grad Student
Avatar
Rank
Total Posts:  77
Joined  03-07-2008

I have followed dfbills instructions to a t and still I cannot import the events to Google Calendar. I always get a “Can’t parse the calendar” error from gCal. Importing into iCal works fine.

The calendar in question is here: http://wolfart.nl/feeds/agenda-ical.xml

Profile
 
 
Posted: 17 December 2008 09:56 PM   [ Ignore ]   [ # 26 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  117
Joined  11-12-2002

docflo: I missed your post before, but it looks like the template is not currently returning any data at all.

pro:~ dfbills$ curl http://wolfart.nl/feeds/agenda-ical.xml | mate
  
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0
--:--:-- --:--:-- --:--:--     0
Profile
 
 
Posted: 18 December 2008 03:56 AM   [ Ignore ]   [ # 27 ]  
Grad Student
Avatar
Rank
Total Posts:  77
Joined  03-07-2008

Oh, hi. I changed the URL for that feed. After several tries it still didn’t work in gCal so I gave up and let gCal be gCal for a while.

When I tried one week later gCal imported the feed flawlessly. So I guess either they changed their .ics interpreter (highly improbable) or it was a caching issue where they had cached the first (broken) version of the feed that I tried to add (that’s probably it).

Anyhoo, thanks for your plugin and your help!

Profile
 
 
Posted: 09 March 2009 05:48 PM   [ Ignore ]   [ # 28 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  641
Joined  11-29-2005

Hi,

I just found this. Is it running smoothly, and have you uploaded the newest version?

Thx,

Ben

 Signature 

e x p design, llc: a consultative approach to web site design and development.
EE Pro Network | ExpressionEngine Install Best Practices | EE Developer: Build web sites with ExpressionEngine

Profile
 
 
Posted: 23 June 2009 05:46 AM   [ Ignore ]   [ # 29 ]  
Summer Student
Total Posts:  1
Joined  06-22-2009

Does anyone know if it is possible to publish calendars hosted on CalDAV via EE?

Profile
 
 
Posted: 02 October 2009 10:13 AM   [ Ignore ]   [ # 30 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  117
Joined  11-12-2002

I just loaded it and it looks like   the weblog call isn’t being parsed.  I get:

BEGIN:VCALENDAR
VERSION
:2.0
X
-WR-CALNAME: WEL Event Calendar
PRODID
:-//My/ Events//NONSGML v1.0//EN
X-WR-TIMEZONE:US/Eastern
{exp
:weblog:entries weblog="events" status="not closed" show_future_entries="yes" dynamic="yes" disable="member_data|pagination|trackbacks|categories" show_expired="no"}
BEGIN
:VEVENT
UID
:{entry_id}
DTSTAMP
:{entry_date format="%Y%m&#xd;T;%H%i&#xsZ;"}
DTSTART
;VALUE=DATE:{entry_date format="%Y%m&#xd;T;%H%i&#xsZ;"}
DTEND
;VALUE=DATE:{entry_date format="%Y%m&#xd;T;%H%i&#xsZ;"}
SUMMARY
:{exp:vcal_encode}{title}{/exp:vcal_encode}
DESCRIPTION
:{exp:vcal_encode}{event_details}{/exp:vcal_encode}
LOCATION
:{exp:vcal_encode}{event_location}{/exp:vcal_encode}
END
:VEVENT{/exp:weblog:entries}
END
:VCALENDAR
Profile
 
 
Posted: 07 October 2009 12:52 PM   [ Ignore ]   [ # 31 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  117
Joined  11-12-2002

I’ve actually got limits on mine so that the data pulled isn’t too large.

Loading individual events seems like a cool idea-I’d pass the entry id in the url so that you’re calling it like this:

http://216.242.88.170/templates/Events/vcal.php/558786

where “558786” is the entry ID.  Unfortunately, I think that sites doing these one-off events handle this with a downloaded file, since you don’t really want to subscribe to individual events, you probably want to add to an existing calendar.

Profile
 
 
Posted: 23 October 2009 12:58 PM   [ Ignore ]   [ # 32 ]  
Summer Student
Total Posts:  4
Joined  10-23-2009

Everything’s going well but for some reason when I import into Outlook, it replicates the calendar every time I import. Any ideas?

Profile
 
 
   
2 of 2
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 02:47 PM
Total Registered Members: 119539 Total Logged-in Users: 75
Total Topics: 125770 Total Anonymous Users: 48
Total Replies: 661801 Total Guests: 416
Total Posts: 787571    
Members ( View Memberlist )
Newest Members:  nottRobinKendpkitoyfr1arHomer Landisrogersgoldminesaricflan344Polzmejustulike