Timetravel is an add-on for EE 2.x and EE 1.6.x that makes navigating through entries by day, month or year a breeze. It behaves similar to the default pagination, except that it uses dates in the URL instead of page numbers.
It’s usage is pretty much self explanatory and ties in to some of the default behavior of the channel:entries tag.
Example:
{exp:timetravel by='day' channel='news'}
{oldest}<a href="http://{path=news}">Oldest</a>{/oldest}
{older}<a href="http://{path=news}">Older</a>{/older}
{newer}<a href="http://{path=news}">Newer</a>{/newer}
{newest}<a href="http://{path=news}">Newest</a>{/newest}
<strong>{current format='%F %j%S, %Y'}</strong>
{/exp:timetravel}
{exp:channel:entries channel='news'}
// Your entry data
{/exp:channel:entries}The timetravel tag accept many of the same parameters that are also available to the channel:entries tag.
Parameters
by = day|month|year
author_id = Member id category = Category id category_group = Category Group id channel = Channel short name entry_id_from = Entry id entry_id_to = Entry id group_id = Member group id show_expired = yes|no show_future_entries = yes|no status = Status start_on = Date (%Y-%m-%d %H:%i) stop_before = Date (%Y-%m-%d %H:%i) uncategorized_entries = yes|no username = Member username
As you can see the list is almost the same as the channel:entries tag, except for a few that would interfere with the inner workings of Timetravel.
The URL’s generated by the {path} tags inside the Timetravel navigation are appended with the date.
// This
{older}<a href="http://{path=news}">Older</a>{/older}
// Outputs something like this
<a href="http://www.domain.com/news/2010/05/21">Older</a>Because the channel:entries tag already allows for entries to be displayed by day, there is no need to change anything to it. The only exception to this is navigation by year. EE doesn’t filter the resultset based on year alone, unless you specifically tell it to by using the year parameter.
{exp:channel:entries channel='news' year='{segment_2}' dynamic='off'}
// Your entry data
{/exp:channel:entries}A copy of Timetravel is available for download on GitHub for you to play with.
I hope you like it and wish you godspeed on your travels through time.
Greetz, Wouter
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.