Skip to main content
updated code formatting
Source Link
Solspace
  • 6.1k
  • 1
  • 14
  • 20

I have a monthly calendar, and I just want to change the color of a day if it has an event on that day. It works great with single day events, but for days that span multiple days, day_event_total only counts the first day. Code looks like this:

<td class="day_cell {if day_event_total > 0}has_events{/if}">
    {if day_event_total > 0}
    <a class="num"
        href="{path='/envelopers/community/calendar'}/{date format="%Y/%m/%d"}/">
    {/if}
    <div class="date">
        {date format="%j"}
    </div>
    {if day_event_total > 0}
        </a>
    {/if}
{if:else}
    <td class="day_cell out_of_range">
    <div class="date">
    <span class="num">
        {date format="%j"}
    </span>
    </div>
{/if}
</td>

{if:else}

{date format="%j"} {/if}

I have a monthly calendar, and I just want to change the color of a day if it has an event on that day. It works great with single day events, but for days that span multiple days, day_event_total only counts the first day. Code looks like this:

<td class="day_cell {if day_event_total > 0}has_events{/if}">
{if day_event_total > 0}
<a class="num"
    href="{path='/envelopers/community/calendar'}/{date format="%Y/%m/%d"}/">
{/if}
    <div class="date">
        {date format="%j"}
    </div>
{if day_event_total > 0}
</a>
{/if}

{if:else}

{date format="%j"} {/if}

I have a monthly calendar, and I just want to change the color of a day if it has an event on that day. It works great with single day events, but for days that span multiple days, day_event_total only counts the first day. Code looks like this:

<td class="day_cell {if day_event_total > 0}has_events{/if}">
    {if day_event_total > 0}
    <a class="num"
        href="{path='/envelopers/community/calendar'}/{date format="%Y/%m/%d"}/">
    {/if}
    <div class="date">
        {date format="%j"}
    </div>
    {if day_event_total > 0}
        </a>
    {/if}
{if:else}
    <td class="day_cell out_of_range">
    <div class="date">
    <span class="num">
        {date format="%j"}
    </span>
    </div>
{/if}
</td>
Source Link

Color Coding days if they have multi-day events

I have a monthly calendar, and I just want to change the color of a day if it has an event on that day. It works great with single day events, but for days that span multiple days, day_event_total only counts the first day. Code looks like this:

<td class="day_cell {if day_event_total > 0}has_events{/if}">
{if day_event_total > 0}
<a class="num"
    href="{path='/envelopers/community/calendar'}/{date format="%Y/%m/%d"}/">
{/if}
    <div class="date">
        {date format="%j"}
    </div>
{if day_event_total > 0}
</a>
{/if}

{if:else}

{date format="%j"} {/if}