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
Calendar Script CommunityCustomizationCustomizing CalendarScript (Moderators: scott, DanO, Marty)Conditional Links from event title
Pages: [1]   Go Down
Print
Author Topic: Conditional Links from event title  (Read 370 times)
0 Members and 1 Guest are viewing this topic.
Dale
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: September 15, 2002, 01:56:00 PM »

Hi,

I am trying out CalendarScript at our webpage:
http://www.gavitsports.org/cgi-bin/calendar.pl

By default all events are hyperlinked on the calendar view page. I would like to turn off the links if there is no event description.

From what I have looked at I will need to modify the default.html file so that the code checks for a value for the description and outputs the event title with the html anchor attributes if there is a description and without the html attributes if there isn't a description.

Has anyone else done this? I searched the forum and didn't locate an answer.

I am new to Perl and to using SSI from html pages.

------------------
Dale Ray
http://www.gavitsports.org/
softball@gavitsports.org
http://www.dopplerexpress.net/~daleray/dale.html

Logged

DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #1 on: September 15, 2002, 08:29:00 PM »

   
quote:
I will need to modify the default.html file so that the code checks for a value for the description and outputs the event title with the html anchor attributes if there is a description and without the html attributes if there isn't a description.

That's right. Try something like the following in the appropriate place in the default.html template file:

code:
in place of

<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" CLASS="gridtext"><%= EVENT FIELD(title) %></A><BR>

try

<% if ($EVENT->{'details'}->{'description'} ) { ## Line Corrected July 20th, 2004 %>
<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" CLASS="gridtext"><%= EVENT FIELD(title) %></A><BR>
<% } else { %>
<%= EVENT FIELD(title) %>
<% } %>


Dan O.

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

Corrected <% if ($EVENT->{'details'}->{... line!

[This message has been edited by DanO (edited July 20, 2004).]

Logged
Dale
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #2 on: September 15, 2002, 08:34:00 PM »

Thanks,

I will try that tomorrow. I appreaciate the help.

------------------
Dale Ray
http://www.gavitsports.org/
softball@gavitsports.org
http://www.dopplerexpress.net/~daleray/dale.html

Logged

Brainwrap
New Member
*

Karma: 0
Offline Offline

Posts: 0

Website Developer


WWW
« Reply #3 on: July 20, 2004, 02:58:00 PM »

Hi there!

I, too, would like to tweak it so that the HTML code doesn't appear unless there's something to link to in the description.

However, I cannot make the change you (DanO) suggested because I'm also using the "MetaCalendar" plugin, which dramatically changes that exact string of code already (I tried adding the "<% if ($EVENT..." tags before and after it, but it gave me a nasty error when I tried).

Here's the original line of code:

<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" CLASS="gridtext"><%= EVENT FIELD(title) %></A><BR>

Here's what MetaCalendar has it changed to:

<A HREF="#" onClick="return gotolink('<%= $EVENT->{'details'}->{calendarref} %>', '<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>&datestring=<%=$DAY->{datestring}%>&starttime=<%= &main::URLEncode($EVENT->{'schedule'}->{'start_time'}) %>&endtime=<%= &main::URLEncode($EVENT->{'schedule'}->{'end_time'}) %>')" CLASS="gridtext"><%= EVENT FIELD(title) %></A><BR>

You suggested adding the following tags before and after:

Before:

<% if ($EVENT->{'details'}->{'description'} { %>

After:

<% } else { %>
<%= EVENT FIELD(title) %>
<% } %>

However, as I said, this doesn't work on the MetaCalendar-altered code...  

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #4 on: July 20, 2004, 08:43:00 PM »

   
quote:
You suggested adding the following tags before and after:

Before:

<% if ($EVENT->{'details'}->{'description'} { %>


The reason that line may not work is it's not quite correct. It should be:

<% if ($EVENT->{'details'}->{'description'} ) { # Note the ) bracket %>

I didn't realize it because the OP never bothered to follow up on the message here.  

quote:
OOPS! Sorry, somehow I posted that three times!
You should be able to edit your previous posts to remove any unnecessary/duplicate text.  

JFYI


Dan O.


[This message has been edited by DanO (edited July 20, 2004).]

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