EllisLab text mark
Advanced Search
     
show entries for last 2 weeks(14 days) in order from newest to oldest
Posted: 12 July 2010 09:55 AM   [ Ignore ]
Joined: 2006-09-06
539 posts

I want to display entries only from the last 2 weeks or 14 days, which ever is easier.  (not NOT the last 14 entries, but any entries that fall within the last 14 days)

I also want them to be in order so the most recent entry is on top and they desc down to the oldest entry that falls in the last 14 days or 2 weeks.

I am using:

{exp:weblog:entries weblog="sheets"  display_by="week" limit="2" orderby="date" sort="asc" show_future_entries="no" show_expired="yes" rdf="off" switch="row3|row4" 

And works pretty good if I use order=“asc”  they are ordered in reverse so the oldest in the 2 weeks shows up first and then orders down to the newest at the bottom.

Problem is if I switch it to order=“desc” then I get last weeks in proper order newest to oldest, then at the very bottom I get this weeks newest to oldest. 

How can I get this to work?  Would using the start_on parameter be my best bet?  if so how do I set that to be start_on 14 days ago sort by date, list by day, and order newest to oldest?

TIA

 Signature 

EastwoodDesign.ca

 
Posted: 12 July 2010 02:59 PM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Joined: 2006-09-06
539 posts

This is what I got to work for me.

<?php global $LOC;
          
$current_time =$LOC->decode_date('%Y-%m-%d %g:%i %A'$LOC->now 1209600);
?>
{exp
:weblog:entries weblog="sheets" category="7" sort="desc" orderby="date" sort="desc" start_on="<?php echo $current_time; ?>" show_future_entries="no" show_expired="yes" rdf="off" switch="row3|row4" 
 Signature 

EastwoodDesign.ca

 
Posted: 12 July 2010 03:16 PM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2004-05-15
29075 posts

Probably more of a “Howto” question, but I’m glad you found an answer smile Please post again as needed.