Help - Search - Members - Calendar
Full Version: Linking to previous entry from multi-entry index
Movable Type Community Forum > Additional Resources > Tips and Tricks
Georgina
I display two days' worth of entries on my index page.  I'd like to add a 'previous' link to the bottom of the index that goes to the individual archive page of the entry before the last one on the index page, so you can browse backwards though the archives.

For example, if entries 220 - 212 were displayed on the index page, as they'd been posted in the last two days, then a 'previous' link at the bottom of the index page would take you to the individual archive of entry 211.

Clearly, the problem here is getting mt to know the 'previous' link should go to 211.  I've poked through the manual and searched the board, but I can't work out how to do it.  Any ideas, please?
kadyellebee
There are several ways to do it - here's what I do, though smile.gif

CODE
<MTEntries lastn="1" offset="2">
<a href="<$MTEntryLink archive_type="Individual"$>">previous entry</a>
</MTEntries>

Since you have two entries showing, you use an offset value to skip those and go to the next entries infor.

Try that out, and if it doesn't work how you were hoping, post back smile.gif

Kristine
tamaracks
It's not two entries, it's two days. That changes things a bit, but I'm not sure how to get around it.
kadyellebee
Oh sorry, I obviously didn't read closely, did I? biggrin.gif

From the manual, there's a solution with the MTEntriesFooter, and although I know I was chastised before for suggesting this container in the wrong context, I think I've got it now smile.gif

Put this code right before the /MTEntries of your main MTEntries container.
CODE
<MTEntriesFooter>
<MTEntryPrevious>
<a href="<$MTEntryLink archive_type="Individual"$>">Previously: <$MTEntryTitle$></a>
</MTEntryPrevious>
</MTEntriesFooter>


Hope that works better smile.gif
Kristine
Georgina
That did indeed work perfectly, whoo.

Thanks, Kristine.  :)
kadyellebee
Glad that it worked, even if it took me a few tries!! smile.gif

Kristine
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.