Thank you Calguy!!
For those who can understand my logic here's my hack. Note, the two categories I have are No5 and No7:
<td valign="top" align="right" {if isset($day.class)}class="{$day.class}"{/if}{foreach from=$day.events item=event}{if count($day.events) == "2" || $event.categories.0.category_name == "No5"} style="background-color: #444;color:#f0f0f0;"{else} style="background-color:#a0c084;"{/if}{/foreach} style="background-color:#a0c084;">
The logic:
If there are 2 events in that day OR the event is tied to the category I mentioned, then run the style proposed, else just make the background the defaul color.
Works like magic. Thanks for the tip Calguy!!
The full Calendar Display template:
Code: Select all
{strip}
<div class="nextprev">
<span class="calendar-prev"><a href="{$navigation.prev}"><img src="uploads/images/bg/arrow-left.png" alt="" /></a></span>
<span class="calendar-month">{$month_names[$month]} {$year} </span>
<span class="calendar-next"><a href="{$navigation.next}"><img src="uploads/images/bg/arrow-right.png" alt="" /></a></span>
</div>
<table class="calendar-big" id="cal-calendar" cellpadding="0" cellspacing="2">
<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}"> </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 valign="top" align="right" {if isset($day.class)}class="{$day.class}"{/if}{foreach from=$day.events item=event}{if count($day.events) == "2" || $event.categories.0.category_name == "No5"} style="background-color: #444;color:#f0f0f0;"{else} style="background-color:#a0c084;"{/if}{/foreach} style="background-color:#a0c084;">
{if isset($day.events.0)}{$key}
{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}"> </td>
{/if}
</tr>
</tbody></table>
{/strip}
<br />
<br />
{strip}
<table class="calendar-big" id="cal-calendar" cellpadding="0" cellspacing="2">
<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}"> </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 valign="top" align="right" {if isset($day.class)}class="{$day.class}"{/if}{foreach from=$day.events item=event}{if count($day.events) == "2" || $event.categories.0.category_name == "No7"} style="background-color: #444;color:#f0f0f0;"{else} style="background-color:#a0c084;"{/if}{/foreach} style="background-color:#a0c084;">
{if isset($day.events.0)}{$key}
{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}"> </td>
{/if}
</tr>
</tbody></table>
{/strip}