start_on and stop_before questions/issues - Events listing
Posted: 05 September 2008 03:31 PM   [ Ignore ]  
Summer Student
Total Posts:  8
Joined  08-29-2008

Hello, I just can’t quite seem to get this to work. I’d like to have 2 events listings: one for upcoming and one for past. I tried following another example in the forums, but not quite getting it… I want the events to automatically move to the past events list when they’re past (duh.) Does it have something to do with the entry date vs. my “event date” that I’ve created?

Here’s the code i have: any clues? I’m new to this… can you tell?


<h1>Upcoming Events:</h1>

{exp:weblog:entries weblog="news" orderby="event_date" sort="asc" limit="3" start_on="{current_time format="%D, %F %d, %Y"} 11:59 PM" show_future_entries="yes" dynamic="off"}
<h2>{title}</h2>
<
h3>{event_date format="%D, %F %d, %Y"}</h3>
<
p>{event_location}<br>
<
p>{event_description}</p><br>
{/exp:weblog:entries}


<h1>Past Events:</h1>
{exp:weblog:entries weblog="news" orderby="event_date" sort="desc" limit="3" stop_before="{current_time format="%D, %F %d, %Y"} 11:59 PM" show_expired="yes" dynamic="off"}
<h2>{title}</h2>
<
h3>{event_date format="%D, %F %d, %Y"}</h3>
<
p>{event_location}<br>
<
p>{event_description}</p>
{/exp:weblog:entries}

Profile
 
 
Posted: 10 October 2008 09:24 AM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  7
Joined  02-05-2008

For others trying to do similar functionality with a custom date field, here is a solution using PHP in a template.  Enable your template for PHP on output for starters.  For the past events code, change to:

<h1>Past Events:</h1>
<?php
  $count
= 0;
  
$limit = 3;
?>
{exp
:weblog:entries weblog="news" orderby="event_date" sort="desc" show_expired="yes" dynamic="off"}
<?php
  
if ($count < $limit)
  
{
?>
{if current_time
> event_date}
<h2>{title}</h2>
<
h3>{event_date format="%D, %F %d, %Y"}</h3>
<
p>{event_location}<br>
<
p>{event_description}</p>
<?php
    $count
++;
?>
{
/if}
<?php
  }
?>
{
/exp:weblog:entries}

 Signature 

Jason Ferrell

Tallboy Creative
Design, Development and Strategy for the Web

Profile
 
 
   
 
 
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: 64912 Total Logged-in Users: 31
Total Topics: 81863 Total Anonymous Users: 19
Total Replies: 440096 Total Guests: 172
Total Posts: 521959    
Members ( View Memberlist )
Newest Members:  bjmohrAqua193Bios Elementmjpoteetguimogranwelshmrcfthenetmonkeybenekwhobutsb