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 CommunityCustomizationHacks and Mods (Moderators: scott, DanO, Marty)Need a link to current month
Pages: [1]   Go Down
Print
Author Topic: Need a link to current month  (Read 574 times)
0 Members and 1 Guest are viewing this topic.
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« on: April 30, 2004, 06:50:00 PM »

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
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: April 30, 2004, 08:11:00 PM »

You can try using the following as a conditional:

if ($TODAY_MONTH != $MONTH)

Dan O.

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

Logged
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« Reply #2 on: May 01, 2004, 01:27:00 PM »

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%> ?

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

Logged
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« Reply #3 on: May 01, 2004, 03:45:00 PM »

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?

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

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: May 01, 2004, 05:19:00 PM »

** 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.

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #5 on: May 01, 2004, 05:24:00 PM »

** 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).]

Logged
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« Reply #6 on: May 01, 2004, 07:13:00 PM »

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).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #7 on: May 01, 2004, 09:10:00 PM »

** 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->
  • .

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

  • .
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.

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

Logged
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« Reply #8 on: May 01, 2004, 09:57:00 PM »

It Works!
Thanks Dan

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #9 on: May 02, 2004, 01:09:00 PM »

Glad to hear it.

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

Dan O.

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

Logged
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« Reply #10 on: May 02, 2004, 09:06:00 PM »

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).]

Logged
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« Reply #11 on: May 02, 2004, 10:53:00 PM »

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).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #12 on: May 03, 2004, 12:27:00 PM »

** 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.

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

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

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


WWW
« Reply #13 on: May 03, 2004, 12:33:00 PM »

** <!-- 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.

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

Logged
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« Reply #14 on: May 05, 2004, 01:05:00 AM »

Thanks. I'm learning a lot.

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

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