UBBFriend: Email This Page to Someone!
  CalendarScript Support Forum
  Hacks and Mods
  Need a link to current month

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

next newest topic | next oldest topic
Author Topic:   Need a link to current month
musicvid
Member
posted April 30, 2004 06:50 PM     Click Here to See the Profile for musicvid     Edit/Delete Message
I'd like to put a link that says, View Current Month on all month views except the current one. It would return them to the default month view. Can someone suggest some code?
TIA

IP: Logged

DanO
Member
posted April 30, 2004 08:11 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
You can try using the following as a conditional:

if ($TODAY_MONTH != $MONTH)

Dan O.

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

IP: Logged

musicvid
Member
posted May 01, 2004 01:27 PM     Click Here to See the Profile for musicvid     Edit/Delete Message
Yes, this works.

Right now the I am using a conventional link like this to get back to the current month view:
<% if ($TODAY_MONTH != $MONTH) { %>
<BR><CENTER><a href="http://ovationplayers.com/cgi-bin/calendar/calendar.pl?template=doublecal.html#calendar">View Current Month</a> </CENTER><% } %>

Is there a slicker way to do this using <%=$CGI_URL_QUERYSTRING%> ?

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

IP: Logged

musicvid
Member
posted May 01, 2004 03:45 PM     Click Here to See the Profile for musicvid     Edit/Delete Message
Got It!

<!-- Return Link -->
<% if ($TODAY_MONTH != $MONTH) { %>
<CENTER>
<a href="<%= $CGI_URL_QUERYSTRING %>view=Month&month=<%=$TODAY_MONTH%>#calendar" title="View Current Month">View Current Listings <%= $TODAY_MONTH %>/<%= $YEAR %></a></CENTER><% } %>

(The #calendar is just an anchor in my html).

THX to Matt, Dan, Dave et al. for being such excellent teachers. Being a lazy copy-and-paste artist, I'm actually learning something here! I pray for your continued patience...

Is it possible to have a TODAY_MONTH_NAME template?

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

IP: Logged

DanO
Member
posted May 01, 2004 05:19 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
** Is it possible to have a TODAY_MONTH_NAME template? **

I don't know what you mean by that.

You can have the calendar display in any template you like by adding the template designator to its URL. Eg. ...calendar.pl?template=Template_Name_Here.html

Dan O.

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

IP: Logged

DanO
Member
posted May 01, 2004 05:24 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
** Is there a slicker way to do this using <%=$CGI_URL_QUERYSTRING%> ? **

That would send the calendar right back to the exact same view as what they were seeing. You could use something like <%= $CGI_URL %>?template=doublecal.html#calendar

You can see a list of the available CalendarScript variables in the Documentation : Defined Variables.

Dan O.


[This message has been edited by DanO (edited May 01, 2004).]

IP: Logged

musicvid
Member
posted May 01, 2004 07:13 PM     Click Here to See the Profile for musicvid     Edit/Delete Message
I'm not using the right terminology, so new to this.

The code I used three posts up is working, except it returns a "5" instead of "May".

I found defined variables like:
$MONTH_NAME and $TODAY_MONTH but nothing that would return the name of the current month, similar to $NEXT_MONTH_NAME or $LAST_MONTH_NAME so I was wondering if something like "$TODAY_MONTH_NAME" is possible.

I found references to these variables in the calendar.pl file but I don't understand their significance, so I'm in a bit over my head.

[This message has been edited by musicvid (edited May 01, 2004).]

IP: Logged

DanO
Member
posted May 01, 2004 09:10 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
** The code I used ( View Current Listings <%= $TODAY_MONTH %>/<%= $YEAR %> ) is working, except it returns a "5" instead of "May". ... but nothing that would return the name of the current month **

I don't think there is such a variable. You'll likely have to use one of the following:

quote:
$MONTH_NAMES - A reference to an array of the names of the months. The name of the first month would be $MONTH_NAMES->[0].

$MONTH_ABBREVIATIONS - A reference to an array of the abbreviations of months. The abbreviation of the first month would be $MONTH_ABBREVIATIONS->[0].


You could use them something like:

<%= $MONTH_NAMES->[$TODAY_MONTH-1] %>

(You need the -1 in there because the array starts counting at 0 which would be for January)

Dan O.

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

IP: Logged

musicvid
Member
posted May 01, 2004 09:57 PM     Click Here to See the Profile for musicvid     Edit/Delete Message
It Works!
Thanks Dan

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

IP: Logged

DanO
Member
posted May 02, 2004 01:09 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
Glad to hear it.

BTW, did you try the fix for the DoubleCal template plug-in?

Dan O.

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

IP: Logged

musicvid
Member
posted May 02, 2004 09:06 PM     Click Here to See the Profile for musicvid     Edit/Delete Message
OK, here is what I got working, I bet it could be simplified a bit. It's useful in the DoubleCal 'Month View' but I suppose it would work in Day and Event Views too.

<!-- Return Link -->
<% if ($TODAY_MONTH != $MONTH) { %>
<a href="<%= $CGI_URL_QUERYSTRING %>view=Month&month=<%=$TODAY_MONTH%>&year=<%=$TODAY_YEAR%>#calendar" title="View Current Month">View Current Month - <%= $MONTH_NAMES->[$TODAY_MONTH-1] %> <%= $TODAY_YEAR %></a>
<%} elsif ($TODAY_YEAR != $YEAR) { %>
<a href="<%= $CGI_URL_QUERYSTRING %>view=Month&month=<%=$TODAY_MONTH%>&year=<%=$TODAY_YEAR%>#calendar" title="View Current Month">View Current Month - <%= $MONTH_NAMES->[$TODAY_MONTH-1] %> <%= $TODAY_YEAR %></a><% } %>


>>"BTW, did you try the fix for the DoubleCal template plug-in?<<

Yes, but I had to wait until today (May 2) to confirm it is working. See reply.

I have to say your support makes the price of the plugin seem insignificant. Test site w/some frills on the DoubleCal template here: http://ovationplayers.com/cgi-bin/calendar/calendar.pl?template=home.html

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

[This message has been edited by musicvid (edited May 02, 2004).]

IP: Logged

musicvid
Member
posted May 02, 2004 10:53 PM     Click Here to See the Profile for musicvid     Edit/Delete Message
Is there a way to fix the rag left edge on the event links in 'Month View' after I took the <BR> out?
(see link one up)
------------------

[This message has been edited by musicvid (edited May 02, 2004).]

IP: Logged

DanO
Member
posted May 03, 2004 12:27 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
** Is there a way to fix the rag left edge on the event links **

I'm afraid I don't know what you mean by that. The regular month view looks fine to me.

Dan O.

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

IP: Logged

DanO
Member
posted May 03, 2004 12:33 PM     Click Here to See the Profile for DanO   Click Here to Email DanO     Edit/Delete Message
** <!-- Return Link -->
<% if ($TODAY_MONTH != $MONTH) { %> **

BTW. If both those conditional are just printing the same link, you should be able to use a single conditional:

<!-- Return Link -->
<% if ($TODAY_MONTH != $MONTH | | $TODAY_YEAR != $YEAR) { %>

(The "| |" means "OR")

This forum software adds a apace between the | | in the above code which should not be there otherwise. If you try the code be sure to remove the space between the "| |"

Dan O.

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

IP: Logged

musicvid
Member
posted May 05, 2004 01:05 AM     Click Here to See the Profile for musicvid     Edit/Delete Message
Thanks. I'm learning a lot.

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

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