1 of 7
1
Repeet: A Plugin for Displaying Repeating Entries
Posted: 06 February 2006 04:23 PM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  750
Joined  08-16-2003

I am pleased to announce the first public release of Repeet, a plugin for displaying repeating entries. This first release is version 0.9.1.1 and is not final. I am releasing this version in the hopes that a) some of you will find it useful, and b) you will help me improve the plugin to the level of a 1.0 release.

Purpose

Repeet arose out of my interest to create an events calendar or events list on my website. I quickly realized, however, that I could save myself a ton of work (and a lot of database clutter) if I could get the entries to repeat automatically at regular intervals. Why create an entry every two weeks if I could create just a single entry and have it repeat automatically? The plugin took off from there.

Name

Yes, I spelled the name of the plugin correctly. It’s Repeet, as in a REPeaTing entries plugin for EE. Get it?

Features

Repeet features three main functions

* Displaying a list of events using standard exp:weblog:entries tags
* Displaying events in calendar format like the built-in exp:weblog:calendar creates. (A huge thank you to the EE team for allowing me to include modified EE code for this feature.)
* Displaying the occurrences (past and/or future) of an individual event

Requirements

Repeet has been tested with EE 1.3.2 and greater. Repeet requires the creation of three custom fields in the weblog(s) in which you choose to use its features. The custom fields allow you to set the repeat interval, define custom occurrence dates and date ranges, and exclude dates and date ranges for each entry.

Documentation and Examples

Repeet is not a simple “plug and play” plugin, so you will definitely need to read the documentation before using it. The plugin doesn’t modify the database or anything, but you still want to know what you’re doing. I have provided several working examples, including the code used to produce the examples, to help you get started.

Download

You can download the latest version of the plugin from the documentation page. Remember, this is pre-1.0 software, so use at your own risk. I don’t make any promises about the functionality.

Feedback

I would love to hear your feedback. You are welcome to comment here, PM me, or use the e-mail link provided on the documentation page. I’m especially interested in hearing about potential real-world usage scenarios and seeing your applications and test pages.

 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
Posted: 06 February 2006 04:40 PM   [ Ignore ]   [ # 1 ]  
Moderator
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  32921
Joined  05-14-2004

I can’t wait for the weekend when I can play with this.  Thank you for making it available!

 Signature 
Profile
MSG
 
 
Posted: 06 February 2006 10:46 PM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  244
Joined  05-16-2004

Wonderful!!!

I too can’t wait for the weekend, and a chance to test this out!! Thank you also for providing initial documentation and code samples - this helps my wee brain (especially when I’m STILL fighting my new computer to make it dual-boot Ret Hat Enterprise Linux and Windows XP…and don’t really know if I’m winning, or if it’s just toying with me.)

Profile
 
 
Posted: 07 February 2006 02:48 AM   [ Ignore ]   [ # 3 ]  
Grad Student
Avatar
Rank
Total Posts:  39
Joined  11-26-2002

OUTSTANDING! I can’t wait to play with this; it’s just what I needed for my current project!!

Profile
 
 
Posted: 09 February 2006 06:23 PM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  769
Joined  03-16-2002

Really impressive ... thanks for sharing!

-Markus

Profile
 
 
Posted: 10 March 2006 12:54 PM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  750
Joined  08-16-2003

Repeet 0.9.2 is now available. Changes from 0.9.1.1 include:

*  Removed the requirement that the three custom fields (repeat interval, include dates, exclude dates) must exist. The custom fields are now optional.
* Added the interval_value parameter to the exp:weblog:calendar tag that can be used to hard-code a repeat interval if the repeat interval custom field is absent.
* The repeet:interval variable pair is now optional. If absent, the repeat interval will default to “none”.
* The repeet:include_dates variable pair is now optional.
* The repeet:exclude_dates variable pair is now optional.
* Added the ability to specify a category in the URL. Numeric (C100) or text (categories/mycategory) categories may be used.
* Fixed a small issue in create_occurrences_array() that could throw PHP warnings in particular circumstances.

The plugin can be downloaded at the documentation page.

 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
Posted: 23 March 2006 11:08 AM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  750
Joined  08-16-2003

Repeet 0.9.3 is now available. Changes from 0.9.2 include:

* Fixed a bug that caused errors to be thrown if an empty line or invalid date was sent via the custom include field. (Thanks, Sean!)
* Added the ability to make events repeat indefinitely.
* Fixed a bug in the calendar routine involving empty (not null) include and exclude values. (Thanks Doug!)
* Specifying multiple weblogs (and custom fields) in the calendar did not work properly, but should now work as expected.
* Specifying custom statuses in the calendar did not work properly, but should now work as expected.

The plugin can be downloaded at the documentation page.

I have received some incredibly helpful feedback from several users. I’m thrilled to see that folks find the plugin useful. Please don’t hesitate to let me know if you run across any bugs or unexpected behavior. And feel free to send me feature requests as you think of them. My to-do list for the plugin before I call it 1.0 is relatively short right now, so speak up!

 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
Posted: 10 April 2006 12:59 AM   [ Ignore ]   [ # 7 ]  
Lab Assistant
RankRank
Total Posts:  213
Joined  05-15-2004

Question: Why don’t you just use a blank expiration date to mark an unbounded (never-ending) event? 

I tried this and ended up with the following warning:

Warning: strtotime() [function.strtotime]: Called with an empty time parameter. in ......../plugins/pi.repeet.php on line 165

I fixed it by making the following change (line 165):

ORIG: $item_expiration_date = (isset($matches[1])) ? strtotime($matches[1]) : $item_entry_date;

NEW:
$item_expiration_date = (isset($matches[1])) ? ($matches[1] == '' ? 2114402400 : strtotime($matches[1])) : $item_entry_date;

This not only stops the error but also makes it so entries display forever…at least in the listing events template code.  The calendar is fixed using the following change (near line 1671):

ORIG: if($expy_date < $end_date)

NEW: if(
$expy_date < $end_date && $row['expiration_date'])

The way you already have it works too, but it just seems more intuitive to allow no expiration and use that to create ‘endless’ events.

 Signature 

Ed
King of Fools
Blogrescue.com

Profile
 
 
Posted: 10 April 2006 06:34 AM   [ Ignore ]   [ # 8 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  750
Joined  08-16-2003

That’s one way to do it, but you’re only thinking specific to your needs. Using your method, how does one set up an event that occurs from 9:00am to 10:00am every Wednesday from 4/5/06 through 12/31/06?

I am contemplating a code rewrite before Repeet hits 1.0, with this issue being one that I may revisit. (Repeet started out as a much smaller project, so it’s not surprising that it outgrew its britches by a fair bit.) I’m still pondering that, though.

 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
Posted: 10 April 2006 08:10 AM   [ Ignore ]   [ # 9 ]  
Lab Assistant
RankRank
Total Posts:  213
Joined  05-15-2004

I’m not sure I see where you are coming from.  To bound an event, simply provide an expiration date.  However, it just seems like to create an unbound event (repeats forever), no expiration date makes the most sense.

 Signature 

Ed
King of Fools
Blogrescue.com

Profile
 
 
Posted: 10 April 2006 09:37 AM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  750
Joined  08-16-2003

Sorry, I misspoke. Consider an event that occurs from 9:00am to 10:00am every Wednesday with no end date. In that case, the end time (10:00am) needs to come from somewhere. If not the expiration date, where?

That being said, I’ve made a change for Repeet 0.9.4. If the expiration date is blank and the repeat interval is set to something other than ‘none’, the entry will repeat indefinitely. That will only work, however, for entries that don’t require a time range. So an entry that repeats every Wednesday at 9:00 will repeat indefinitely if no expiration date is set; an entry that repeats every Wednesday from 9:00 to 10:00 will require the expiration date to be set because that’s where Repeet pulls the end time from.

Repeet 0.9.4 isn’t quite ready for public download. If you want to give it a whirl, drop me an e-mail or a PM.

 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
Posted: 10 April 2006 12:21 PM   [ Ignore ]   [ # 11 ]  
Lab Assistant
RankRank
Total Posts:  213
Joined  05-15-2004

Ok, I now understand why expiration dates might be required for an eternal event.  Thanks.  (I was simply going to add a custom duration field…)

 Signature 

Ed
King of Fools
Blogrescue.com

Profile
 
 
Posted: 18 April 2006 09:01 AM   [ Ignore ]   [ # 12 ]  
Research Assistant
RankRankRank
Total Posts:  845
Joined  08-05-2005

I’d like to display 2 consecutive months of mini calendars on my home page with a link to a page with 12 months of mini calendars. 

It seems that I can set the date month=“05” year=“2006” manually but the repeated entries don’t seem to be showing up on it.

Is it possible to show multiple mini calendars on the same page?

Profile
 
 
Posted: 18 April 2006 10:20 AM   [ Ignore ]   [ # 13 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  750
Joined  08-16-2003

Is it possible to show multiple mini calendars on the same page?

It is now.

After banging my head on the keyboard for a while, I found that I only needed to add 2 simple lines of code. I have posted a really ugly, but working, example. I’ve sent a new copy of the plugin to your PM inbox for you to try. Please let me know how it works for you.

 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
Posted: 24 April 2006 09:42 AM   [ Ignore ]   [ # 14 ]  
Research Assistant
RankRankRank
Total Posts:  845
Joined  08-05-2005

I’ve been trying to figure this out for a few days and have run out of ideas.

On my home page I am listing events by day and week.  For the week display I am only getting events for that day.  If a repeating event shows up, it displays the date for the first instance of that event.

My code:

{exp:repeet:parse date_header_interval="day"}
{repeet
:date_header}<h1 class="main_title">to do today %l, %F %j%S, %Y</h1>{/repeet:date_header}
{repeet
:no_results}<p>There are no events posted for today.</p>{/repeet:no_results}
{exp
:repeet:get_ids weblog="event" parse="inward" status="open|featured"}
{exp
:weblog:entries weblog="event" entry_id="{repeet:entry_ids}" show_expired="yes" show_future_entries="yes" dynamic="off" status="open|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}{repeat_interval}{/repeet:interval}
{repeet
:include_dates}{include_dates}{/repeet:include_dates}
{repeet
:exclude_dates}{exclude_dates}{/repeet:exclude_dates}
{repeet
:display}
<div class="event_summary">
<
h2><a href="{title_permalink="main/entry"}">{title}</a></h2>
<
p>{short_description}</p>
<
p>Today at {repeet:start_time format="%H:%i"}, {price} <a href="{title_permalink="main/entry"}" class="more">MORE INFO</a></p>
<
p class="cat_list">filed under: {categories backspace="1"}<a href="{path=main/cat}">{category_name}</a>, {/categories}.</p>
</
div>
{/repeet:display}
{
/repeet:item}
{
/exp:weblog:entries}
{
/exp:repeet:get_ids}
{
/exp:repeet:parse}

{exp
:repeet:parse date_header_interval="week"}
{repeet
:date_header}<h1 class="main_title">to do week of %F %j, %Y</h1>{/repeet:date_header}
{repeet
:no_results}<p>There are no events posted for this week.</p>{/repeet:no_results}
{exp
:repeet:get_ids weblog="event" parse="inward" status="open|featured"}
{exp
:weblog:entries weblog="event" entry_id="{repeet:entry_ids}" show_expired="yes" show_future_entries="yes" dynamic="off" status="open|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}{repeat_interval}{/repeet:interval}
{repeet
:include_dates}{include_dates}{/repeet:include_dates}
{repeet
:exclude_dates}{exclude_dates}{/repeet:exclude_dates}
{repeet
:display}
<div class="event_summary">
<
h2><a href="{title_permalink="main/entry"}">{title}</a></h2>
<
p>{short_description}</p>
<
p>{repeet:start_time format="%D. %M. %n, %g:%i%a"}, {price} <a href="{title_permalink="main/entry"}" class="more">MORE INFO</a></p>
<
p class="cat_list">filed under: {categories backspace="1"}<a href="{path=main/cat}">{category_name}</a>, {/categories}.</p>
</
div>
{/repeet:display}
{
/repeet:item}
{
/exp:weblog:entries}
{
/exp:repeet:get_ids}
{
/exp:repeet:parse}

http://www.cocotodo.com

The repeating events are registering correctly on the mini calendars

I’ve attatched a screen shot of my fields also - I’ve checked them a dozen times to make sure they were correct but maybe someone else will see something that I’m not.

THANKS!

Image Attachments
fields.gif
Click thumbnail to see full-size image
Profile
 
 
Posted: 24 April 2006 10:00 AM   [ Ignore ]   [ # 15 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  750
Joined  08-16-2003

For the section devoted to this week’s events, you want:

{exp:repeet:get_ids weblog="event" parse="inward" status="open|featured" begin="today" end="1 week"}

Unrelated, but I also noted that rather than

{repeet:start_time format="%D. %M. %n, %g:%i%a"}

you probably want

{repeet:start_time format="%D. %M. %j, %g:%i%a"}

(%j rather than %n).

 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
Posted: 24 April 2006 10:06 AM   [ Ignore ]   [ # 16 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  750
Joined  08-16-2003

By the way, depending on your desired output you could also do any of the following:

{exp:repeet:get_ids weblog="event" parse="inward" status="open|featured" begin="today" end="6 days"}


{exp:repeet:get_ids weblog="event" parse="inward" status="open|featured" begin="monday" end="sunday"}


{exp:repeet:get_ids weblog="event" parse="inward" status="open|featured" begin="last monday" end="next sunday"}

...and so on.

 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
Posted: 24 April 2006 10:59 AM   [ Ignore ]   [ # 17 ]  
Research Assistant
RankRankRank
Total Posts:  845
Joined  08-05-2005

Beautiful.  I don’t believe your example on your Repeet page defines begin and end - not that I’m complaining, the documentation there is excellent smile

And that date format was related - that’s what was making me think it was displaying the original entry date.

Also,

begin="monday" end="sunday"

did what I need

begin="today" end="1 week"

displayed 2 weeks worth of headings

Thanks!

Profile
 
 
Posted: 24 April 2006 11:33 AM   [ Ignore ]   [ # 18 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  750
Joined  08-16-2003

FYI, now that I think about it,

begin="monday" end="sunday"

may not work perfectly. It works today because today is Monday, but tomorrow, it may think that by “monday” you mean next Monday. That’s not a Repeet thing, but something determined by this stuff. Check it out tomorrow and see what happens.

The reason you’re seeing 2 weeks worth of headings with

begin="today" end="1 week"

is you’re actually getting 8 days (Monday through Monday, in this case), rather than 7. To get 7 days, you could use:

begin="today" end="6 days"

Also remember that Repeet’s weekly date headings kick in every Monday. So if today is Thursday, April 27, and you want to show events happening in the next seven days, with the code you’re using you’ll see something like this:

Events happening the week of April 24:

Thursday, April 27
Friday
, April 28
Saturday
, April 29
Sunday
, April 30

Events happening the week of May 1
:

Monday, May 1
Tuesday
, May 2
Wednesday
, May 3

I’m guessing that’s not what you want. You may instead want to try something like:

<h1 class="main_title">Events coming up in the next week</h1>{exp:repeet:parse date_header_interval="day"}
{repeet
:date_header}<h2>to do on %l, %F %j, %Y</h2>{/repeet:date_header}
{repeet
:no_results}<p>There are no events posted in the next week.</p>{/repeet:no_results}
{exp
:repeet:get_ids weblog="event" parse="inward" status="open|featured" begin="1 day" end="6 days"}
...and so on

That will get you a list of events from tomorrow through 6 days from now (Sunday, in today’s case), with a header for each day on which there is an event. (You don’t necessarily need to list today’s events again because you’re already doing that with the other chunk of code you posted above.) The weekly date headers are also possible, but you may need to use some PHP, a la:

if today is monday:
  use
begin="today" end="sunday"
else
  use
begin="last monday" end="sunday"

 Signature 

Pst… have you taken a look at Weever yet?

Profile
 
 
   
1 of 7
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65075 Total Logged-in Users: 25
Total Topics: 82208 Total Anonymous Users: 15
Total Replies: 441825 Total Guests: 158
Total Posts: 524033    
Members ( View Memberlist )
Newest Members:  TomsBmackskithbtggAdminempoleongwishPasha MahardikarmarkdurandomcatClutch Bearings