Help - Search - Members - Calendar
Full Version: Weekly blog tricks?
Movable Type Community Forum > Additional Resources > Tips and Tricks
MattB
Morning! I'm working on a photo diary - one photo every day, 7 photos posted every Sunday morning - and would like the entire week to show on one page. Since I really will only post once a week, the "7 days displayed" in config is fine, and weekly archives are okay too.

Where I have a problem is I'd like the index page to be the latest week, but it needs to have a "previous" link to go to the previous week in the archives. When I use:

CODE
<MTArchivePrevious>
<a href="<$MTArchiveLink$>">previous week</a>
</MTArchivePrevious>


I get "Build error in template 'Main Index': Error in <MTArchivePrevious> tag: You used an <MTArchivePrevious> without a date context set up." which I guess is because it's a tag I'm only supposed to use on archive pages.

Anyone have any idea how I can achieve what I'm after? Site's at PolaroiDiary if you'd like to have a look. Thanks!
almuhajabah
Do you have Weekly Archives set up? Go into Weblog Config | Archiving to see.
MattB
Yes, I have weekly archives.
almuhajabah
It always helps to check the most basic things first wink.gif

It sounds like you're using the MTArchivePrevious tags on an index page. They're meant to be used on an archive page, to link to the previous archive page. Your main index page isn't an archive page so MT doesn't know what to do with it.

The problem with what you want to do is that MT can create a link to the current or most recently weekly archive:

CODE
<MTArchiveList archive_type="Weekly" lastn="1">
...other tags here...
</MTArchiveList>


But there's no "offset" attribute for MTArchiveList to tell it to list the previous week but not the current week. huh.gif
girlie
CODE
<MTArchiveList archive_type="Weekly" lastn="1">
<MTEntries>
...other tags here for latest week's entries...
</MTEntries>
<MTArchivePrevious>
<a href="<MTArchiveLink archive_type="Weekly">">previous week</a>
</MTArchivePrevious>
</MTArchiveList>


MTArchivePrevious tags work inside of MTArchiveList as well as on archive pages.

(Note that the code above would replace your existing MTEntries container.)
almuhajabah
Very clever! I was thinking in terms of just the link at the bottom of the page, but replacing the whole MTEntries container ought to do it wink.gif
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.