[EventCalendar] New experimental "Event Loop" code.

Dr. Peter Troxler peter.troxler at gmx.net
Sat Oct 11 21:16:03 UTC 2008


amazing & well done ... looking forward to reading the code and do all  
sorts of interesting stuff with it. congratulations & thank you!

/ Peter

On 11 okt 2008, at 02:23, Alex Tingle wrote:

> Now that we've got the stable release out of the way, I've checked- 
> in my new
> code. I've had it floating around for months - today I've polished  
> it up,
> corrected it, and written some documentation.
>
> I've added new, much more flexible template functions. Allows events  
> to be
> accessed in their own 'loop', either all events sorted by date, or  
> all events
> within a post. Look at the new implementations of ec3_get_events() and
> ec3_get_schedule() for examples of how to use the new functionality.  
> **Highly
> experimental**
>
> Here are two examples of how you might use it:
>
>
>     // All future events in date order.
>     // Posts with multiple events will appear multiple times.
>     //   [E.g. Used to implement ec3_get_events()]
>
>     query_posts('ec3_after=today');
>     if(have_posts())
>     {
>       ec3_all_events();
>       while(ec3_have_events())
>       {
>         ec3_the_event();
>         ...
>       }
>     }
>
>
>     // First a normal loop over the current query's posts.
>     while(have_posts())
>     {
>       the_post();
>       // Now a nested loop, over the events in each post.
>       //   [E.g. Used to implement ec3_get_schedule()]
>       ec3_post_events();
>       while(ec3_have_events())
>       {
>         ec3_the_event();
>         ...
>       }
>     }
>
> Wherever you see '...', then you can use normal WP template  
> functions, like
> the_title() etc, and also the new EC functions, summarised below:
>
>
>  /** Get a human-readable 'time since' the current event. */
>  function ec3_get_since()
>
>  /** Get the start time of the current event. */
>  function ec3_get_start_time($d='')
>
>  /** Get the end time of the current event. */
>  function ec3_get_end_time($d='')
>
>  /** Get the start month of the current event. */
>  function ec3_get_start_month($d='F Y')
>
>  /** Get the end month of the current event. */
>  function ec3_get_end_month($d='F Y')
>
>  /** Get the start date of the current event. */
>  function ec3_get_start_date($d='')
>
>  /** Get the end date of the current event. */
>  function ec3_get_end_date($d='')
>
>  function ec3_get_time($d='')  { return ec3_get_start_time( $d); }
>  function ec3_get_month($d='') { return ec3_get_start_month($d); }
>  function ec3_get_date($d='')  { return ec3_get_start_date( $d); }
>
>  /** Get the current version of the EC3 plug-in. */
>  function ec3_get_version()
>
>
> The new implementation of ec3_get_events() has a couple of extra  
> tricks. For
> example, set $limit to a negative number to list past events - I  
> know that's
> been a popular request.
>
>
> I *think* that this link takes you to the development version:
>  http://downloads.wordpress.org/plugin/event-calendar.zip
>
>
> -Alex
>
> -- 
> :: Let me solve your problems: http://www.firetree.net/consulting/
> :: alex.tingle AT firetree.net  +44-7901-552763
>
> _______________________________________________
> Blog: http://wpcal.firetree.net/
> EventCalendar at firetree.net mailing list
> Unsubscribe: http://penguin.firetree.net/eventcalendar




More information about the EventCalendar mailing list