Help - Search - Members - Calendar
Full Version: list entries from oldest to newest?
Movable Type Community Forum > Additional Resources > Tips and Tricks
dzacharias
Hi all,

I produced a blog that serves up an entry from a different category each day, but what I want to do is have a queue of entries and have it post the oldest this week, the second oldest next week, the third oldest the following week, and so on. I don't think it's as easy as changing the sort order, right? Can anybody think of a trick for that?

Thanks!
ndns
I'm not sure exactly how you would do that, but this code would show a list of ALL entries, starting with the oldest. Maybe you can adapt it somehow.
CODE
<MTEntries lastn="9999999" sort_order="descend">
<a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a>
</MTEntries>
dzacharias
Thanks! But then how would it know to go to the next entry?

I was thinking...is there some way to tell it to start from entry #78, and go up from there? And then I just have to figure out the number of the oldest post in each category?

btw you can see it in action as the section "DAILY GOBBETS" on http://bluemag.com
dzacharias
Okay, something just came to me...

CODE
<MTEntries lastn="1" offset="1" category="whatever" sort_order="descend">


wouldn't that get you the second oldest post?

In which case, if there was some way to change that 1 to a 2 next week, a 3 the week after, etc. automatically...get a new number each time it rebuilds?
dzacharias
Okay, building on my previous post, I'm almost done with this, but I can't get it to work. I need help from somebody with experience using document.write to write MT tags.

Here is what I've got:

CODE
var now = new Date();
var today = now.getDay();

if (today == 0)
{
    var baseDate = new Date(2004, 3, 25);  // the first date that there was a sunday entry
    var weeks = (now - baseDate) / (7 * 86400000);
    var weeksRounded = Math.round(weeks)
    document.write('<MTEntries encode_js="1" lastn="1" category="sunday" offset="');
    document.write(weeksRounded);
    document.write('"><MTEntryBody></MTEntries>');
}


and so on... but this doesn't work. I can get it to write the weeksRounded variable, and i can get it to write the lastn=1 post, but it doesn't seem to be getting the offset=1 part. What am I doing wrong?

Thanks!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.