I’m setting up an event calendar using the “Repeet” plugin, and so far, I’ve been pretty successful. But there’s one thing that I haven’t quite figured out how to do satisfactorily.
I simply want to display a list of 5 upcoming events on the homepage. Now, at first look, this looks really simple. I wouldn’t even need to use the “Repeet” plug-in, but just a standalone {exp:weblog:entries} with the necessary parameters (“limit”, “dynamic”, “start_on”) set correctly.
But then I started thinking about repeating events. Let’s say that I have the homepage set to display 5 events, but in reality, two of the events that I want to display are actually occurrences of the same event. I want that event to display twice in the list, which brings me back to using “Repeet” plugin. But I’m not exactly sure how to do this.
I’ve tried toying with the “date_header_interval”, “begin”, and “end” parameters of the {exp:repeet:parse} tag, but to no avail. And I tried looking through the various examples on the “Repeet” website, but couldn’t find one that was exactly like the situation I described.
I’m sure there has to be someone else who has run into this issue. Perhaps I’m over-thinking the issues?
I have the same problem right now. I want to display the next 6 events. I have this so far:
{exp:repeet:parse date_header_interval="day"}
{repeet:no_results}{current_time format="%Y-%m-%d"}<h1>Sorry, no results.</h1>{/repeet:no_results}
{repeet:date_header}<h1>%F %Y</h1>{/repeet:date_header}
{exp:repeet:get_ids weblog="events_calendar" parse="inward" begin="2008-09-1" end="2008-12-12"}
{exp:weblog:entries weblog="events_calendar" entry_id="{repeet:entry_ids}" show_expired="yes" show_future_entries="yes" dynamic="off"}
{repeet:item}
{repeet:entry_id}{entry_id}{/repeet:entry_id}
{repeet:entry_date}{entry_date format="%Y-%m-%d %H:%i"}{/repeet:entry_date}
{repeet:expiration_date}{expiration_date format="%Y-%m-%d %H:%i"}{/repeet:expiration_date}
{repeet:interval}{event_repeat}{/repeet:interval}
{repeet:include_dates}{include_dates}{/repeet:include_dates}
{repeet:exclude_dates}{exclude_dates}{/repeet:exclude_dates}
{repeet:display}
<h2>{title}</h2>
{event_description}
{/repeet:display}
{/repeet:item}
{/exp:weblog:entries}
{/exp:repeet:get_ids}
{/exp:repeet:parse}
This will work and pull my test event that starts on 9/15 and repeats every week though it will only display it once. Also when I change the begin to 2008-09-17 for example, the event doesn’t display so its not checking the repeat date only the initial start date of an event for some reason.
Anyone got any ideas?
I was trying for 5 or 6 upcoming events too, but I haven’t been able to get that to work. I tried the “limit” parameter, but for repeating events, all occurrences of the event are counted as one, so that’s out.
My solution was to limit the display to a defined time period rather than a certain number of events. Building on the code in the previous post, I came up with the variant below. The key was using “today” and “1 month” (my chosen time period) for the values of the “begin” and “end” parameters. I’m also using a special “Featured” status to pull only certain events to this listing. And “dynamic” is set to “off” because the list is populated with events from the “calendar” weblog but is being displayed on the home page.
A couple of additional notes:
First, “event_ending_time” is a custom date field that I’ve added so that I can display the ending time for certain repeating events independently from the expiration date. Although it requires an additional field to be filled in, only a few events have defined ending times, so it’s not very onerous.
Second, I’ve left “{repeet:date_header}” blank because I want the date to display for each featured entry in the list and I want to style it with absolute positioning in the context of the entry.
{exp:repeet:parse date_header_interval="day"}
{repeet:no_results}{current_time format="%Y-%m-%d"}{/repeet:no_results}
{repeet:date_header}{/repeet:date_header}
{exp:repeet:get_ids weblog="calendar" parse="inward" begin="today" end="1 month" status="Featured"}
{exp:weblog:entries weblog="calendar" entry_id="{repeet:entry_ids}" show_expired="yes" show_future_entries="yes" dynamic="off" status="Featured"}
{repeet:item}
{repeet:entry_id}{entry_id}{/repeet:entry_id}
{repeet:entry_date}{entry_date format="%Y-%m-%d %H:%i"}{/repeet:entry_date}
{repeet:expiration_date}{expiration_date format="%Y-%m-%d %H:%i"}{/repeet:expiration_date}
{repeet:interval}{event_repeat_interval}{/repeet:interval}
{repeet:include_dates}{event_include_dates}{/repeet:include_dates}
{repeet:exclude_dates}{event_exclude_dates}{/repeet:exclude_dates}
{repeet:display}
<div class="item event">
<h3>{repeet:start_time format="%D<br />%M %j"}</h3>
<h4>{title}</h4>
<h5>{repeet:start_time format="%g:%i %a"}{if event_ending_time} – {event_ending_time format="%g:%i %a"}{/if}</h5>
{if event_location=="Offsite"}{event_location_offsite}{/if}
{event_summary}
<!-- <a href="#">Read more</a> » -->
</div>
{/repeet:display}
{/repeet:item}
{/exp:weblog:entries}
{/exp:repeet:get_ids}
{/exp:repeet:parse}
In my case, there will probably be very few repeating events that are “Featured,” but using this code rather than the standard weblog:entries tag will give me flexibility if I do want to include any repeating events in the list.
I’d still like to see a solution that limits the listing to a defined number of events, but in the meantime I hope this is helpful.
I am having a (sort of) similar issue. Repeet works fine as far as, the repeat factor, but I can not for the life of me limit the number of entries that are displayed.
Check this link: http://www.ardenfirstbaptist.org/index.php/site/times_directions
here is my repeet code.
{exp:repeet:parse date_header_interval="day"}
{repeet:no_results}{current_time format="%Y-%m-%d"}{/repeet:no_results}
{repeet:date_header}{/repeet:date_header}
{exp:repeet:get_ids weblog="events" parse="inward" begin="today" end="1 month"}
{exp:weblog:entries weblog="events" entry_id="{repeet:entry_ids}" show_expired="yes" show_future_entries="yes" dynamic="off"}
{repeet:item}
{repeet:entry_id}{entry_id}{/repeet:entry_id}
{repeet:entry_date}{begin_date format="%Y-%m-%d %H:%i"}{/repeet:entry_date}
{repeet:expiration_date}{end_date format="%Y-%m-%d %H:%i"}{/repeet:expiration_date}
{repeet:interval}{event_repeat_interval}{/repeet:interval}
{repeet:include_dates}{event_include_dates}{/repeet:include_dates}
{repeet:exclude_dates}{event_exclude_dates}{/repeet:exclude_dates}
{repeet:display}
<li><span class="date">{repeet:start_time format="%M"}
<span>{repeet:start_time format="%j"}</span></span><span class="title"><a href="/index.php/site/news_events#{title}" title="Click for Info or Sign-up for {title}">{title}</span></a></li>
{/repeet:display}
{/repeet:item}
{/exp:weblog:entries}
{/exp:repeet:get_ids}
{/exp:repeet:parse}
This does nothing to limit the number of events. I’ve tried…everything but the solution. Any thoughts?
I figured this out but I needed to use php so you will have to enable it on the template.
I am displaying 6 events.
<?php $count = 0; ?>
{exp:repeet:parse date_header_interval="day"}
{repeet:date_header}<?php if ($count < 6) { ?><div class="upcoming_event_day"><strong>%F %j, %Y</strong></div><?php } ?>{/repeet:date_header}
{exp:repeet:get_ids weblog="events_calendar" parse="inward" begin="today" end="1month"}
{exp:weblog:entries weblog="events_calendar" entry_id="{repeet:entry_ids}" show_expired="yes" show_future_entries="yes" dynamic="off"}
{repeet:item}
{repeet:entry_id}{entry_id}{/repeet:entry_id}
{repeet:entry_date}{entry_date format="%Y-%m-%d %H:%i"}{/repeet:entry_date}
{repeet:expiration_date}{expiration_date format="%Y-%m-%d %H:%i"}{/repeet:expiration_date}
{repeet:interval}{repeat_interval}{/repeet:interval}
{repeet:include_dates}{include_dates}{/repeet:include_dates}
{repeet:exclude_dates}{exclude_dates}{/repeet:exclude_dates}
{repeet:display}<?php
if ($count < 6) {
$count++;
echo '<div class="upcoming_event_title"><a href="http://{url_title_path=events/details}">{title}</a> ({repeet:start_time format="%g:%i%A"})</div>';
}
?>{/repeet:display}
{/repeet:item}
{/exp:weblog:entries}
{/exp:repeet:get_ids}
{/exp:repeet:parse}
Wow, thanks. It’s a simple solution! I don’t know why, but I was not thinking outside of the functionality of the plugin. Simply limiting it with php didn’t cross my mind. Thank you!
Sill, it would be nice if i could use the plugin with the begining and end params. Maybe we’re doing it wrong? I don’t know. But i have what I need now, and don’t want to mess with it more than I have at this point.
I’ll just parse a google cal feed next time. 😊
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.