Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Pages: 1 [2]   Go Down
Print
Author Topic: rss feed calendar  (Read 1660 times)
0 Members and 1 Guest are viewing this topic.
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #15 on: October 21, 2005, 01:17:00 PM »

** that could only be done from within a plug-in, not just from a template.**

* I tried adding some lines to my calendar.pl *

I should have clarified that: It can only be done through a plug-in other
than modifying the calendar.pl file *which is not a good idea* as it
isn't very portable. It might be Ok for just testing though.

JMO

Dan O.

[This message has been edited by DanO (edited October 21, 2005).]

Logged
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« Reply #16 on: November 22, 2005, 03:43:00 PM »

I have written a new rss template from scratch that works in conjunction with DanO's SearchLink plugin. The advantage is that you can create multiple customized RSS feeds "on the fly" using a single template and search functions such as duration and event field terms.

It outputs valid RSS 2.0 with one minor exception of the "Content-type:" issue noted above. The xml parses correctly in everything I've tried sofar including My! Yahoo.

Niceties (but not necessities) would be the ability to pass day names in the search results, and 'hh:mm:ss zzz' to the lastBuildDate.

The zipped template is here:  ftp://shell.dimensional.com/users/musicvid/pub/utilities/RssCalendar.zip

A working example can be seen here, assuming you have a reader, personalized page, or Firefox: Ballroom Dance Events
(You would right-click on the link and "Copy Link Location")
Note that the example only searches for "Ballroom" events from the master calendar for 185 days. You can leave the '&FIELD_=' criteria blank to display all events in a calendar.

I'll check back here for feedback and bugs before issuing a final version.


[This message has been edited by musicvid (edited November 22, 2005).]

[This message has been edited by musicvid (edited November 23, 2005).]

Logged
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« Reply #17 on: November 25, 2005, 06:02:00 PM »

I fixed the Content:type for .xml templates by changing a little code in calendar.pl

Find:

unless ($no_header) {
   print "Content-type: text/html\n\n";
   }

Change To:

unless ($no_header) {
   unless ($in{'template'} =~ m/.xml$/)  {
      print "Content-type: text/html\n\n";
   }
   else {
      print "Content-type: application/xml\n\n";
   }}

Usually not necessary, but there if you need it or like squeaky-clean output like I do.

------------------

[This message has been edited by musicvid (edited November 25, 2005).]

Logged
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« Reply #18 on: December 01, 2005, 12:13:00 PM »

After a little more observation to be sure the searchable RSS template is working properly, I'll send it on to DanO.
The latest version can be downloaded at http://www.calendarscript.com/support/forum/rss-calendar-2-t1527.0.html
The RFC822 date is now fully functional and compliant. Here is the result of my inquiry into the subject, although it may be too much information, maybe someone will find it useful.
--------------------------------------------------------------------
There are two approaches to calling an RFC-822 date in your or xml fields. An RFC-822 date is one that is in the format:
Wed, 02 Oct 2002 08:00:00 EST
Wed, 02 Oct 2002 13:00:00 GMT
Wed, 02 Oct 2002 15:00:00 +0200
(Source: feedvalidator.org)
--------------------------------------------------------------------
1)The simplest is to include this code AFTER but BEFORE the tag:
<% use Date::Manip qw(ParseDate UnixDate);
my $rfc822_format = "%a, %d %b %Y %H:%M %Z";
my $today = ParseDate("Now");
my $rfc822_date = UnixDate($today,$rfc822_format); %>

Then you can call the date like this: <%= $rfc822_date %>
The drawback is this only works on Unix servers, and is a bit slower than calling it from Calendarscript.
--------------------------------------------------------------------
2)This method involves creating some more template variables in calendar.pl that call the current hh mm ss in the output:

IN CALENDAR.PL FIND:
($Template::TODAY_YEAR,$Template::TODAY_MONTH,$Template::TODAY_DATE) = ($now_yy,$now_mm,$now_dd);

REPLACE WITH:
($Template::TODAY_YEAR,$Template::TODAY_MONTH,$Template::TODAY_DATE,$Template::TODAY_HOUR,$Template::TODAY_MINUTE,$Template::TODAY_SECOND,$Template::TODAY_WEEKDAY,$Template::TODAY_ YEARDAY,$Template::TODAY_DST) = ($now_yy,$now_mm,$now_dd,$now_hh,$now_mi,$now_ss,$now_wd,$now_yd,$now_dst);
$Template::TODAY_MM = &LZ($Template::TODAY_MONTH);
$Template::TODAY_DD = &LZ($Template::TODAY_DATE);
$Template::TODAY_HH = &LZ($Template::TODAY_HOUR);
$Template::TODAY_MI = &LZ($Template::TODAY_MINUTE);
$Template::TODAY_SS = &LZ($Template::TODAY_SECOND);

Note that the last five variables force a two-digit output ('01' instead of '1')

Now you can print an RFC-822 date as follows (Change the time zones to your own):
<% print "$DAY_ABBREVIATIONS->[$TODAY_WEEKDAY], $TODAY_DATE $MONTH_ABBREVIATIONS->[$TODAY_MONTH-1] $TODAY_YEAR $TODAY_HH\:$TODAY_MI\:$TODAY_SS ";
if ($TODAY_DST eq "0") {print "MST";}
elsif ($TODAY_DST eq "1") {print "MDT";}
else {}; %>

Or you can do this:
<%= $DAY_ABBREVIATIONS->[$TODAY_WEEKDAY] %>, <%= $TODAY_DATE %> <%= $MONTH_ABBREVIATIONS->[$TODAY_MONTH-1] %> <%= $TODAY_YEAR %> <%= $TODAY_HH %>:<%= $TODAY_MI %>:<%= $TODAY_SS %> <% if ($TODAY_DST eq "0") {%>MST<% else %>MDT<%}%>

--------------------------------------------------------------------

Here's an example of a NON compliant date using the new variables (above) that you can put in your calendar templates and demonstrate what you can do with the new variables:
<% my $pm_hour=$TODAY_HOUR-12;
print "Viewed on $DAY_ABBREVIATIONS->[$TODAY_WEEKDAY], $MONTH_ABBREVIATIONS->[$TODAY_MONTH-1] $TODAY_DATE $TODAY_YEAR at ";
if ($TODAY_HOUR eq "0") {print "12\:$TODAY_MI\:$TODAY_SS am ";}
elsif (($TODAY_HOUR > "0") && ($TODAY_HOUR < "12")) {print "$TODAY_HOUR\:$TODAY_MI\:$TODAY_SS am ";}
elsif ($TODAY_HOUR eq "12") {print "12\:$TODAY_MI\:$TODAY_SS pm ";}
elsif ($TODAY_HOUR > "12") {print "$pm_hour\:$TODAY_MI\:$TODAY_SS pm ";}
else {};
if ($TODAY_DST eq "0") {print "MST";}
elsif ($TODAY_DST eq "1") {print "MDT";}
else {}; %>

The output looks like this: 'Viewed on Thu, Dec 1 2005 at 9:09:09 am MST'
------------------
« Last Edit: December 28, 2007, 03:46:02 PM by musicvid » Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #19 on: February 18, 2006, 01:48:00 PM »

Mark (aka musicvid) has made the template available for downloading. It in now linked
from the Unofficial CalendarScript - Mods and Plugins site in the 'Templates' section.

JFYI

Dan O.

------------------

Logged
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« Reply #20 on: March 11, 2006, 01:47:00 PM »

Thanks, DanO
The incorporation of your Search Link plugin with this template is a powerful combination, because multiple custom RSS feeds can be generated dynamically without the need for static (cached) files. Hoping others will try it and post their feedback here . . .

------------------

[This message has been edited by musicvid (edited March 11, 2006).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #21 on: November 25, 2006, 05:09:00 PM »

**  <% use Date::Manip qw(ParseDate UnixDate); **

It looks like Date/Manip.pm may not be part of the standard Perl distribution package in which
case users would have to install it on their server in order to use musicvid's XML template.

JFYI

Dan O.


------------------

Logged
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« Reply #22 on: December 01, 2006, 10:16:00 PM »

I've got a brand new version called the RssCalendar2 template, with greatly expanded functionality.

Re Dano's post above, this new one uses Posix (strftime) OR  Date::Format to get the RFC822 date, one or both of which should be on 100% of Perl 5+ server installations.

The new version also has two selectable modes, a Basic mode that utilizes any of the &getEvents functions with only minimal configuration, and the Advanced mode that filters the results in concert with Dano's Searchlink plugin as before.

Other new features:
-- Works with multiple calendars by generating feeds "on the fly," using a single RSS/Event View template set.
-- MetaCalendar friendly, also retrieves which calendar the item came from.
-- Displays the calendar name or description if desired, automatically uses the calendar's custom colors for event display, passes the event day of week or abbreviation, also your organization name or abbreviation, the channel image, and the date/time of last update.

A working example of RssCalendar2 in Basic mode is here:
http://feeds.feedburner.com/LcmaEventsCalendar    
The raw feed XML is here:  http://littletonmusic.org/cgi-bin/calendar/calendar.pl?calendar=default&template=rsscalendar.xml    

An example of RssCalendar2 in Advanced mode that only fetches "Ballroom" events for the next 185 days is here:  http://feeds.feedburner.com/LcmaBallroomEventsCalendar    
The raw feed XML is here:
http://littletonmusic.org/cgi-bin/calendar/calendar.pl?calendar=default&template=rsscalendar.xml&view=Search&command=search&FIELD_event_type=Ballroom&duration=185    

I have used this on my sites for 6 months without issues, but I need to "genericize" it a bit before releasing it and sending a copy to DanO. I plan to do this over the holidays. Hope this will be useful to someone.

[This message has been edited by musicvid (edited December 01, 2006).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #23 on: December 02, 2006, 02:07:00 AM »

I couldn't view the RssCalendar2 in Basic mode raw feed in my IE 7(?) browser. The error
message displayed was:    
quote:
Internet Explorer cannot display this feed

This feed contains code errors.

An invalid character was found in text content.
Line: 250 Character: 63

<description><![CDATA[Sun, 1:30 pm - 3:30 pm -- BOARD MEETING


Which is:

Sun, 1:30 pm - 3:30 pm -- BOARD MEETING ? LCMA BOARD OF DIRECTORS
Sunday, November 19, 2006 ? 1:30PM ? 3:30PM

The RssCalendar2 in Advanced mode displayed fine.

JFYI

Dan O.

------------------

Logged
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« Reply #24 on: December 02, 2006, 10:52:00 AM »

 
quote:
Internet Explorer cannot display this feed

This feed contains code errors.

An invalid character was found in text content.
Line: 250 Character: 63


Sometimes individual characters encoded in ASCII-US creep into XML titles or descriptions and IE doesn't know how to handle them -- like when some email content is pasted directly into an event listing, which is what happened in this case. It's a problem with XML, and some browsers/readers/validators are more picky about it than others.

Anyway, I retyped the offending entry, and it looks fine in my IE now. Let me know if you see any other issues (you may have to clear your IE cache to see the most recent content). Will send you the template files after I have removed a couple of personal customizations.

Thanks DanO!

------------------

[This message has been edited by musicvid (edited December 02, 2006).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #25 on: December 02, 2006, 02:30:00 PM »

It displays fine now.

Dan O.

------------------

Logged
beneath_the_ashes
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #26 on: March 01, 2007, 02:45:00 AM »

so can anyone make sense of this error?

Can't locate Date/Manip.pm in @INC (@INC contains: /usr/local/psa/home/vhosts/domain.com/cgi-bin/calendar/calendarscript/plugins/EmailNotify2/ /usr/local/psa/home/vhosts/domain.com/cgi-bin/calendar/calendarscript/lib /usr/local/lib/perl5/site_perl/5.8.2/mach /usr/local/lib/perl5/site_perl/5.8.2 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.2/BSDPAN /usr/local/lib/perl5/5.8.2/mach /usr/local/lib/perl5/5.8.2 .) at (eval 3) line 3. BEGIN failed--compilation aborted at (eval 3) line 3.

its strange that it mentions EmailNotify2

------------------

[This message has been edited by beneath_the_ashes (edited March 01, 2007).]

Logged
beneath_the_ashes
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #27 on: March 06, 2007, 04:37:00 AM »

i just cant get this rss thing to work at all...any have any ideas to help me get this going?
http://www.wearemanalive.com/cgi-bin/calendar/calendar.pl?calendar=default&template=rsscalendar.xml&view=Search&command=search&FIELD_title=party&duration=14

------------------

Logged
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« Reply #28 on: March 09, 2007, 07:51:00 PM »

You really need to use the updated version, RSS Calendar 2, found here: http://www.calendarscript.com/support/forum/Forum5/HTML/000364.html

Just follow the instructions.

------------------

[This message has been edited by musicvid (edited March 09, 2007).]

Logged
Pages: 1 [2]   Go Up
Print
Jump to: