Put Month Name In CalGuys Calendar

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Put Month Name In CalGuys Calendar

Post by KitchM »

How does one set up the calendar module to display the month name?

Thanks.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Put Month Name In CalGuys Calendar

Post 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
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Put Month Name In CalGuys Calendar

Post 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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Put Month Name In CalGuys Calendar

Post by velden »

Of course there are templates!

Note the 'Templates' link with a scissors icon in front of it (again a little less intuitive).
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Put Month Name In CalGuys Calendar

Post 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.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Put Month Name In CalGuys Calendar

Post by velden »

Module templates are always with the module itself. User doesn't need to know. Only you, and now you know :)
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: Put Month Name In CalGuys Calendar

Post 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}
User avatar
M@rtijn
Power Poster
Power Poster
Posts: 706
Joined: Sat Nov 14, 2009 4:54 pm
Location: the Netherlands

Re: Put Month Name In CalGuys Calendar

Post 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.
Make your community a better place!
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm
Location: OH, USA

Re: Put Month Name In CalGuys Calendar

Post 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>
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
Post Reply

Return to “Modules/Add-Ons”