Page 1 of 1

Put Month Name In CalGuys Calendar

Posted: Mon Jan 20, 2014 9:05 pm
by KitchM
How does one set up the calendar module to display the month name?

Thanks.

Re: Put Month Name In CalGuys Calendar

Posted: Tue Jan 21, 2014 8:58 am
by velden
On does not setup the module to do that. You need to alter the template(s) to do it for you.

Example:

Code: Select all

{$event.event_date_start|date_format:"%B"}
Will print the month name. If the web server is configured properly it will print a localized month name.

Format: http://www.php.net/manual/en/function.strftime.php

Re: Put Month Name In CalGuys Calendar

Posted: Tue Jan 21, 2014 2:59 pm
by KitchM
Thanks. That makes sense.

However, there isn't a template for the calendar, so I can't figure out where to put the code.

Re: Put Month Name In CalGuys Calendar

Posted: Tue Jan 21, 2014 3:02 pm
by velden
Of course there are templates!

Note the 'Templates' link with a scissors icon in front of it (again a little less intuitive).

Re: Put Month Name In CalGuys Calendar

Posted: Tue Jan 21, 2014 7:02 pm
by KitchM
Well, I'll be..... It was right there in the module's own area. Top right corner.

Why aren't they with the section called Templates?

Is there a default one? How does a user know?

Thanks for your help.

Re: Put Month Name In CalGuys Calendar

Posted: Tue Jan 21, 2014 8:41 pm
by velden
Module templates are always with the module itself. User doesn't need to know. Only you, and now you know :)

Re: Put Month Name In CalGuys Calendar

Posted: Wed Jan 22, 2014 10:57 pm
by KitchM
You are all correct. The modules each have their own templates. Except for the weird scissors icon, the convention is followed from the rest of CMSMS.

The basic and currently default template is entitled "sample".

I tried to edit and use the code from velden, but it did nothing.

While I am probably using it incorrectly, I did find the correct placement for the month name on the page, right above the calendar and to the left.

What am I doing wrong? Here's the code:

Code: Select all

{strip}
<table class="calendar" id="cal-calendar">

{$event.event_date_start|date_format:"%B"}

<caption class="calendar-month">
   <span class="calendar-prev"><a href="{$navigation.prev}">&laquo;</a></span>&nbsp;
   &nbsp;<span class="calendar-next"><a href="{$navigation.next}">&raquo;</a></span>
</caption>
<tbody><tr>
{foreach from=$day_names item=day key=key}
<th abbr="{$day}">{$day_short_names[$key]}</th>
{/foreach}</tr>

<tr>
{* initial empty days *}
{if $first_of_month_weekday_number > 0}
<td colspan="{$first_of_month_weekday_number}">&nbsp;</td>
{/if}

{* iterate over the days of this month *}
{assign var=weekday value=$first_of_month_weekday_number}
{foreach from=$days item=day key=key}
{if $weekday == 7}
	{assign var=weekday value=0}
</tr>
<tr>
{/if}
<td {if isset($day.class)}class="{$day.class}"{/if}>
{if isset($day.events.0)}<a href="{$day.ni_url}">{$key}</a>{* by default use the non inline (replace content tag) version of the URL *}
<ul>
{foreach from=$day.events item=event}
<li><a href="{$event.url}">{$event.event_title}</a></li>
{/foreach}
</ul>
{else}{$key}{/if}
</td>
{math assign=weekday equation="x + 1" x=$weekday}
{/foreach}

{* remaining empty days *}
{if $weekday != 7}
<td colspan="{math equation="7-x" x=$weekday}">&nbsp;</td>
{/if}


</tr>
</tbody></table>

{/strip}

Re: Put Month Name In CalGuys Calendar

Posted: Thu Jan 23, 2014 12:56 pm
by M@rtijn
KitchM wrote: While I am probably using it incorrectly, I did find the correct placement for the month name on the page, right above the calendar and to the left
That comes from:

Code: Select all

{$month_names[$month]}
You also have available {$day}, {$month} and {$year} in numerical format.

Re: Put Month Name In CalGuys Calendar

Posted: Thu Jan 23, 2014 3:11 pm
by JohnnyB
The default template shows what is needed:

Code: Select all

<caption class="calendar-month"><span class="calendar-prev"><a href="{$navigation.prev}">&laquo;</a></span>&nbsp;{$month_names[$month]}&nbsp;{$year}&nbsp;<span class="calendar-next"><a href="{$navigation.next}">&raquo;</a></span></caption>