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 [3] 4   Go Down
Print
Author Topic: Adding Date to Event page  (Read 2988 times)
0 Members and 1 Guest are viewing this topic.
TotalHosting
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #30 on: October 03, 2002, 10:22:00 AM »

Hi All. I tried adding the event date to the event display (called from my ssi.html) on my calendar.

This is the code that I incorporated:

code:

<!-- EVENT VIEW -->
      <% } elsif ($VIEW eq "Event") {   use Time::Local;   $EVENT->{'details'} = &getEvent($in{'event_id'});   $db = $main: BSchedule;   $schedules = &Event::getEventsInRange($db,timegm(0,0,0,$DATE,$MONTH-1,$YEAR-1900),timegm(0,0,0,$DATE+1,$MONTH-1,$YEAR-1900)-1);   foreach (@$schedules) {if ($_->{event_id} == $EVENT->{details}->{id}) {$EVENT->{schedule} = $_;last;}}$db = $main: BEvents;$fields = &main: BGetFieldsInDisplayOrder($db);} { %>
         <TABLE BORDER="0" CELLPADDING="2" CELLSPACING="0">
         <%
         foreach (@$fields) {
            next unless ($db->{'properties'}->{$_}->{'display_details'});
         %>
<TR><TD ALIGN="right" VALIGN="top"><SPAN CLASS="text"><B>Time: </B></SPAN></TD><TD ALIGN="left" VALIGN="top"><SPAN CLASS="text">         <%            $start = &Date::formatTime($EVENT->{'schedule'}->{'start_time'}, $Config->get(time_format));            $end = &Date::formatTime($EVENT->{'schedule'}->{'end_time'}, $Config->get(time_format));            if ($EVENT->{'schedule'}->{'all_day'} == "1") { print "All Day"; }            else {               print $start;               if ($start ne $end) { print " - ", $end; }            }         %>         </SPAN></TD></TR>         <TR><TD ALIGN="right" VALIGN="top"><SPAN CLASS="text"><B>Date: </B></SPAN></TD><TD ALIGN="left" VALIGN="top"><SPAN CLASS="text">         <%            $start = &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'start'}, $Config->get(date_format));            $end = &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'end'}, $Config->get(date_format));            print $start;            if ( $start ne  $end) { print " - ", $end; }         %>         </SPAN></TD></TR>
            <TR><TD ALIGN="right" VALIGN="top"><SPAN CLASS="text"><B><%=$db->{'properties'}->{$_}->{'name'}%>: </B></SPAN></TD><TD ALIGN="left" VALIGN="top"><SPAN CLASS="text"><%=$EVENT->{details}->{$_}%></SPAN></TD></TR>
         <% } %>
         </TABLE>

But I get the following error:

quote:

ERROR PROCESSING TEMPLATE
There was an error in your template file. Below is the template file and also the perl code generated from it to help you with debugging.

syntax error at (eval 1) line 195, near "$main:" syntax error at (eval 1) line 195, near "$main:" syntax error at (eval 1) line 195, near "&main:" syntax error at (eval 1) line 202, near "} elsif" syntax error at (eval 1) line 235, near "; }"


and this is what I see (highlighted in yellow) on line 195:

code:

} elsif ($VIEW eq "Event") {   use Time::Local;   $EVENT->{'details'} = &getEvent($in{'event_id'});   $db = $main: BSchedule;   $schedules = &Event::getEventsInRange($db,timegm(0,0,0,$DATE,$MONTH-1,$YEAR-1900),timegm(0,0,0,$DATE+1,$MONTH-1,$YEAR-1900)-1);   foreach (@$schedules) {if ($_->{event_id} == $EVENT->{details}->{id}) {$EVENT->{schedule} = $_;last;}}$db = $main: BEvents;$fields = &main: BGetFieldsInDisplayOrder($db);} {

Any idea what I am doing wrong? I can't even call the calendar now. So I am yanking out this hack. FWIW: I am running a clean install (meaning no mods) to the calendarscript.

thanks

Pete

------------------
Pete
http://www.TotalHosting.com

Logged

delicia
New Member
*

Karma: 0
Offline Offline

Posts: 7


WWW
« Reply #31 on: October 03, 2002, 07:37:00 PM »

i see in your code that in one place $db = $main is preceded by a semicolon, while in another place it is not separated from a field name but adjoins a closing curly bracket. maybe that's one of the errors?

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #32 on: October 03, 2002, 07:43:00 PM »

Maybe you missed this from a posting above?

quote:
Note to any one reading this code: a smiley is a : D (colon D) without the space. While I'm on it, if you see two pipes ('|') anywhere on these bulletin boards, remove the space between them while copying and pasting.

Any code you see like--> :-- space --D or |-- space --| you have to remove any space between them.

Dan O.

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

Logged
bharatk
Guest
« Reply #33 on: October 24, 2002, 05:56:00 PM »

Hi,

I have read all the above messages and thought I'd figured out which bits to change and what links to change but no luck to getting an events date on it's main page - simply get errors.

Can anyone who has got an event page to include this to work simply put one message up with instructions.

Greatly appreciated.

P.S. If you need a link to errors then please wait a bit as I am moving servers - maybe by some freak cosmic influence the new server mau help _ NOT !!!

Logged
kkenwort
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #34 on: October 25, 2002, 11:03:00 AM »

We used the code provided above to add a date to our Calendar Event page.  We have also installed the DaySpan template.  The problem we are having involves a situation where an event occurs for more than one day i.e., Oct. 1 - 2).

When we click on the event (i.e., Oct 1) from the calendar grid, the event page displays a date of 01/01/1970.  AND, in addition to the event being displayed on the grid as a day span item in gray, it is ALSO displayed on EACH day (i.e., it displays as an individual event on Oct. 1 and Oct. 2).

To see my calendar, go to http://apps.nyscul.org/cs/calendar.pl?calendar=nyscul

I visited kayleigh's web site at http://www.mnjaycees.org/cgi-local/calendar31/calendar.pl
and noticed she had the same problem.  See her "tunnel of terror" event for the last week of October.

Does anyone have a solution?  Thanks.

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

Logged
kkenwort
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #35 on: October 25, 2002, 02:29:00 PM »

Sorry.  Need to clarify.  When I said "When we click on the event (i.e., Oct 1) from the calendar grid, the event page displays a date of 01/01/1970", I mis-spoke.

It should read:

When we click on the day SPAN event from the calendar grid, the event page displays a date of 01/01/1970.  (i.e., when we click on the gray area span for Oct 1 - 2.)

Could this be a dayspan template problem?

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

Logged
genevieve
New Member
*

Karma: 0
Offline Offline

Posts: 0


« Reply #36 on: February 19, 2003, 04:28:00 PM »

I'm happy that I've been able to display the date and time in the event view by following TubaDave's directions in his May 3rd post in this thread.  

I'd like to modify one small thing. Does anyone know how I can change the format of the date from MM/DD/YYYY (this may be called SimpleDateFormat in his mod) to something like February 3, 2003?

Thanks a million for your help.  I'm assuming if I knew any perl, this would be easy.

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

Logged
genevieve
New Member
*

Karma: 0
Offline Offline

Posts: 0


« Reply #37 on: February 27, 2003, 02:39:00 PM »

I thought I had the date display working in the event view, but there's a snag.  

It looks like you can't access the event view of any event in the last day of any month.  

Rather, the Error Processing Template appears, saying, "Day 31 out of range 1...30 at (eval 1) line 64.  

If the month has 28 days, like February, the error template says, "Day 29 out of range."

My line 64 is from Tuba Dave's May 3rd post illustrating how to add the date:
   $schedules = &Event::getEventsInRange($db,timegm(0,0,0,$DATE,$MONTH-1,$YEAR-1900),timegm(0,0,0,$DATE+1,$MONTH-1,$YEAR-1900)-1);

Any help would be greatly appreciated!

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

Logged
johannes
Guest
« Reply #38 on: February 28, 2003, 07:29:00 PM »

Hi,

code:

$schedules = &Event::getEventsInRange($db,timegm(0,0,0,$DATE,$MONTH-1,$YEAR-1900),timegm(0,0,0,$DATE+1,$MONTH-1,$YEAR-1900)-1);

for the second timegm use

timegm(59,59,23,$DATE,$MONTH-1,$YEAR-1900)-1

That means don't use $DATE+1
For me this is working.

-----------
A Question:

David says "the date of the currently displayed" could be displayed by

Date : <%= $MONTH_NAME %> <%= $DATE %>, <%= $YEAR %>

This only shows the actually date from my computer. Not a date from an event. Is this correct, or should it really be the date of the actually event?

Regards
Johannes

Logged
raffi
Guest
« Reply #39 on: March 25, 2003, 02:07:00 PM »

I went through these messages up and down, got my default.html all garbled, went through it some more and eventually got stuck with the date showing 01/01/1970 and not showing anything for time.

So I went to a clean new copy of default.html and followed the May 03 instructions, and nothing else.  I get exactly the same problem.  The time does not show, and the date is 01/01/1970.  What could this be?  I did replace the happy face with a colon D without any spaces, so that is not it.  Was there anything else that I should have done outside of the May 03 TubaDave post directions???

Thanks!

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #40 on: March 25, 2003, 02:22:00 PM »

** the date is 01/01/1970. **

It sounds link you're not passing the date in the links to
the event. Did you add the date to the link URLs for the
event as shown in TubaDave's message?

** The time does not show **

I don't know what your problem is there. Sorry.

Dan O.


[This message has been edited by DanO (edited March 25, 2003).]

Logged
raffi
Guest
« Reply #41 on: March 25, 2003, 02:50:00 PM »

I was goofing off with other modifications while I waited for a reply, and now for some reason this one is working fine!  I will keep you updated if it suddenly stops working  
Logged
jdillon
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #42 on: April 15, 2003, 01:40:00 PM »

Using TubaDave's post on 5/3/02, I have managed to get the date and time on the events view of my calendar. But I am still having problems with the search results page. I get the 1/1/70 date and no time. I know the date and time are not being passed correctly but I can't figure out how to modify the search section of default.html.

I've modified the search results url like so:
<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>&datestring=<%=$DAY->{datestring}%>" STYLE="text-decoration:underline;" CLASS="text"><FONT COLOR="<%=EVENT FIELD(color)%>"><%= EVENT FIELD(title) %></FONT></A>

Do I also have to change something here:

elsif ($VIEW eq "Search") {
   $db = $main:  BEvents;
   # Keep form values to populate form fields
   foreach (keys %in) {$name = $_; if ($name =~ s/^FIELD_//) { $search_params->{$name} = $in{$_}; } }
   }
Thanks in advance.
Jon

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

[This message has been edited by jdillon (edited April 15, 2003).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #43 on: April 15, 2003, 02:06:00 PM »

** I am still having problems with the search results page. I get the 1/1/70 date **

The event date is returned in different variables and format from the search function. You'll have to use different code for it in that part of the template.

** and no time. **

I don't see where you've added the time to the link at all!

Try adding something like this to the search results links to see it it helps.

&datestring=<%=$EVENT->{schedule}->{nextoccurrence}->{year}%><% print sprintf("%02d%02d",$EVENT->{schedule}->{nextoccurrence}->{month},$EVENT->{schedule}->{nextoccurrence}->{date}); %>&starttime=<%= $EVENT->{schedule}->{start_time} %>&endtime=<%= $EVENT->{schedule}->{end_time} %>

Dan O.

[This message has been edited by DanO (edited April 15, 2003).]

Logged
jdillon
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #44 on: April 15, 2003, 02:27:00 PM »

That did it! Thanks a million Dan!

Jon

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

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