Skip to content

Instantly share code, notes, and snippets.

@garethredfern
Forked from jamiepittock/ExpressionEngine template
Created November 23, 2012 13:30
Show Gist options
  • Save garethredfern/4135640 to your computer and use it in GitHub Desktop.
Save garethredfern/4135640 to your computer and use it in GitHub Desktop.
Inject events from low_events:entries into low_events:calendar cells
$(".event").each(function() {
// get the ID of the event element
var the_date = $(this).attr("id");
// find the tabel cell with that same ID and append the div
$(this).clone().appendTo('.calendar td#' + the_date);
});
{exp:low_events:calendar
events_field="cf_events_date_time"
date="{freebie_4}"
}
<table class="calendar" cellspacing="0" cellpadding="0">
<thead>
<tr id="month_pager">
<th colspan="1" class="previous"><a href="{structure:page:uri}
on/{prev_month_url}" title="{prev_month format='%F %Y'}">&larr;</a></th>
<th colspan="5" class="month_title"><a href="{structure:page:uri}
on/{this_month_url}"><strong>{this_month format="%F %Y"}</strong></a></th>
<th colspan="1" class="next"><a href="{structure:page:uri}
on/{next_month_url}" title="{next_month format='%F %Y'}">&rarr;</a></th>
</tr>
<tr class="weekdays">
{weekdays}<th scope="col">{weekday}</th>{/weekdays}
</tr>
</thead>
<tbody>
{weeks}
<tr{if is_given_week} class="given-week"{/if}>
{days}
<td class="{if is_current != 'y'}not_current{/if}{if is_given} given{/if}{if is_today} today{/if}" id="date-{day_url}">
{if is_current}
<div class="date">
{day_number}
</div>
{if:else}
&nbsp;
{/if}
</td>
{/days}
</tr>
{/weeks}
</tbody>
</table>
{/exp:low_events:calendar}
<ul class="listing">
{exp:low_events:entries
channel="events"
events_field="cf_events_date_time"
{if freebie_4}date="{freebie_4}"{/if}
{if freebie_4 ==""}date="{current_time format="%Y-%m"}"{/if}
}
<li class="item">
<div class="item_content event" id="date-{cf_events_date_time:start_date format="%Y-%m-%d"}">
<h3><a href="{page_uri}">{title}</a></h3>
<p class="event_location_type">{categories show_group="4" backspace="2"}{category_name}, {/categories}
{if cf_events_date_time:all_day != "y"}
<p class="meta">{cf_events_date_time:start_time format="%H:%i"} - {cf_events_date_time:end_time format="%H:%i"}</p>
{/if}
{if cf_events_date_time:one_day != "y"}
<p class="notice"><a href="{page_uri}">This is a multi-day event. Check the event for full dates</a>.</p>
{/if}
</div>
</li>
{/exp:low_events:entries}
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment