UBBFriend: Email This Page to Someone!
  CalendarScript Support Forum
  Hacks and Mods
  Add name of Day to datestring in Event View

Post New Topic  Post A Reply
profile | register | preferences | search

next newest topic | next oldest topic
Author Topic:   Add name of Day to datestring in Event View
Steve
unregistered
posted February 03, 2003 01:59 PM           Edit/Delete Message
I have succesfully entered the mods (thanks for all the work that is shown in the archives!) to place the time and date on the event page.

However, I'd also like to add the day name to the date string. In other words, I'd like Feburay 3, 2003 to read:

Monday, Feburary 3, 2003.

Any suggestions?

--Steve

IP: Logged

wderzawiec
unregistered
posted November 25, 2004 12:37 PM           Edit/Delete Message
I'd like to know this too. Anyone?

IP: Logged

DanO
Member
posted November 25, 2004 03:42 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
The answer will likely depend on the exact code being used (which we don't know). A simple way may be to just pass it along with the date string information in the link to the Event View page.

Dan O.

[This message has been edited by DanO (edited November 25, 2004).]

IP: Logged

wderzawiec
Junior Member
posted November 25, 2004 08:56 PM     Click Here to See the Profile for wderzawiec     Edit/Delete Message
I'm sorry, I'm not sure what you mean by "exact code." I was able to make the event date appear on the event page by using TubaDave's post of May 3, 2002, found here: http://www.calendarscript.com/support/forum/Forum4/HTML/000169.html

How would I pass the day name to the date string?

The code I am using for the link to the Event View page is: <A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>&datestring=<%=$DAY->{datestring}%>" CLASS="gridtext"><%= EVENT FIELD(title) %></A><BR>

How would I modify this to include the day name? Thanks,

W

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

IP: Logged

DanO
Member
posted November 26, 2004 04:13 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
The weekday name should be available in the calendar grids with the $DAY->{dayname} variable. If you modified the link you're using by adding the following to it:

&dayname=<%= $DAY->{dayname} %>

That information should then be available for printing in the template using a tag like:

<%= $in{dayname} %>

Dan O.

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

IP: Logged

wderzawiec
Junior Member
posted November 26, 2004 07:04 PM     Click Here to See the Profile for wderzawiec     Edit/Delete Message
Wonderful! Thanks so much --

w

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

IP: Logged

DanO
Member
posted November 26, 2004 09:30 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
Did it work for you?

Dan O.

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

IP: Logged

wderzawiec
Junior Member
posted November 26, 2004 10:03 PM     Click Here to See the Profile for wderzawiec     Edit/Delete Message
Yes, thanks!

w

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

IP: Logged

DanO
Member
posted November 27, 2004 08:10 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
Glad to hear it.

Dan O.

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

IP: Logged

musicvid
Member
posted December 05, 2004 11:53 AM     Click Here to See the Profile for musicvid     Edit/Delete Message
Thanks, Dan!
Simply brilliant. I've been looking for one like this for a long time.

I had to use a tag like this to keep the static dayname from being displayed (passed back in the URL) in Month View when returning via link from a Day or Event View page.

<% if ($VIEW eq "Day" | | $VIEW eq "Event") {%><%= $in{dayname} %><%}%>

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

[This message has been edited by musicvid (edited December 05, 2004).]

IP: Logged

DanO
Member
posted December 05, 2004 02:24 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
** I had to use a tag like this to keep the static dayname from being displayed in Month View **

I believe the original question was about modifying the 'Event View' screen so if used just in the Event View part of the template, it shouldn't affect any other displays.

BTW. "dayname" is probably a bad variable name to use for the passed information as it is already a variable used by the calendar. It might be a better idea to use something different like the following so it doesn't over write an existing calendar variable value. Eg.

&thisdayname=<%= $DAY->{dayname} %>

That information should then be available for printing in the template using a tag like:

<%= $in{thisdayname} %>

But you can make up a variable name for yourself which is sure not to be used by CalendarScript otherwise. Maybe "danodayname" ?

This part "$DAY->{dayname}" must remain as it is!

JFYI

Dan O.

[This message has been edited by DanO (edited December 05, 2004).]

IP: Logged

musicvid
Member
posted December 05, 2004 06:53 PM     Click Here to See the Profile for musicvid     Edit/Delete Message
"...if used just in the Event View part of the template, it shouldn't affect any other displays."

Unfortunately, any linkback to Month View from Event View carries &dayname=Tuesday or the like in the URL. Dunno why.

"..."dayname" is probably a bad variable name to use for the passed information as it is already a variable used by the calendar."

Ok, "danodayname" it is!

Thanks again for all your help to us scriptually challenged.

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

IP: Logged

DanO
Member
posted December 05, 2004 08:33 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
** Unfortunately, any linkback to Month View from Event View carries &dayname=Tuesday or the like in the URL. **

That is true but I don't see anywhere else in the default.html template file where $in{dayname} is used to make it visible to users. If you've only added the <%= $in{dayname} %> inside the Event View section, I don't see how it would be displayed anywhere else for users to see.

** any linkback to Month View carries... Dunno why. **

Because CalendarScript is designed to build onto the previous query string for the next time it is used.

JFYI

Dan O.

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

IP: Logged

musicvid
Member
posted December 06, 2004 12:06 AM     Click Here to See the Profile for musicvid     Edit/Delete Message
Ahh, I see the point of confusion. I'm using the Doublecal template and inserting the dayname after $title_tag and before $month_name. Apples and oranges, I should have mentioned it earlier.

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

[This message has been edited by musicvid (edited December 06, 2004).]

IP: Logged

Geoffrey
Junior Member
posted January 16, 2005 08:50 PM     Click Here to See the Profile for Geoffrey   Click Here to Email Geoffrey     Edit/Delete Message
I have gotten the events popup to print out the day name when linked from the calendar in either list view or grid view. However, I have not been able to get it to work when linked from the Search Results.

I have tried adding the &thisdayname=<%= $DAY->{dayname} %> to the <A HREF> tag in the Search View section of the default.html, but alas, no joy.

Any ideas?

------------------
Geoffrey H. Goldberg
Pittsburgh

IP: Logged

DanO
Member
posted January 17, 2005 02:27 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
** &thisdayname=<%= $DAY->{dayname} %> to the <A HREF> tag in the Search View **

The $DAY-> variables are only available in the grids AFAIK.

You can try using <%= $DAY_NAMES->[$EVENT->{schedule}->{nextoccurrence}->{wd}] %> to see if it prints the event's day name. I haven't tried it myself.

Dan O.

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

IP: Logged

Geoffrey
Junior Member
posted January 18, 2005 07:53 PM     Click Here to See the Profile for Geoffrey   Click Here to Email Geoffrey     Edit/Delete Message
Thanks Dan -

It works! It printed out the day name, but for the *following* day. So, I had to subtract 1 from the value.

What I ended up with for my link was:

<A HREF="#" onClick="return gotolink('<%= $EVENT->{schedule}->{calendarref} %>', '<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>&datestring=<%=$EVENT->{schedule}->{nextoccurrence}->{year}%><% print sprintf("%02d",$EVENT->{schedule}->{nextoccurrence}->{month}); %><% print sprintf("%02d",$EVENT->{schedule}->{nextoccurrence}->{date}); %>&thisdayname=<%=$DAY_NAMES->[$EVENT->{schedule}->{nextoccurrence}->{wd}-1] %>&starttime=<%= $EVENT->{schedule}->{start_time} %>&endtime=<%= $EVENT->{schedule}->{end_time} %>')" STYLE="text-decoration:underline;" CLASS="text"><%= EVENT FIELD(title) %></A>

Thanks again -

------------------
Geoffrey H. Goldberg
Pittsburgh

IP: Logged

DanO
Member
posted January 19, 2005 12:50 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
** It works! **

Glad to hear it.

** It printed out the day name, but for the *following* day. So, I had to subtract 1 from the value. **

I thought the $EVENT->{schedule}->{nextoccurrence}->{wd} variable value was adjusted correctly by the script. Make sure there are no problems with events that fall on a Sunday (first day of the week) and Saturday (last day of the week).

Dan O.

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

IP: Logged

Geoffrey
Junior Member
posted January 19, 2005 06:32 PM     Click Here to See the Profile for Geoffrey   Click Here to Email Geoffrey     Edit/Delete Message

It works for Saturday and Sunday too!

------------------
Geoffrey H. Goldberg
Pittsburgh

IP: Logged

All times are CT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic
Post New Topic  Post A Reply
Hop to:

CalendarScript Home