Help - Search - Members - Calendar
Full Version: MTArchivePrevious date context wack out
Movable Type Community Forum > Using Movable Type > Templates and Tags
savantpol
I'm getting error messages when I try to set up category archives. It says that the tag MTArchivePrevious is missing a date context. It seemed to mess up everything. But when I disabled to the category archives, everything works fine. I still want category archives. What do I do?

P.S. I'm new at MT.
trinket
I'm having a similar problem. Rather than start a new thread (and get blasted in the process), I'll elaborate on my problem here.
While I type, I suggest savantpol supply some more details so people know exactly how to help you. Supply some code or a link to your site.

-----------------------------------

I have a photo blog site, and would like to have one entry/photo on the main page, along with a link under that entry to the previous entry. I used the code supplied by the user manual, and this is how I used it:
CODE
<div class="blog"> <MTEntries> <$MTEntryTrackbackData$> <MTDateHeader>
         <h2 class="date"> <$MTEntryDate format="%x"$> </h2>
         </MTDateHeader>
         <div class="blogbody"> <a name="<$MTEntryID pad="1"$></a>
           <h3 class="title"><$MTEntryTitle$></h3>
<$MTEntryBody$> <MTEntryIfExtended> <span class="extended"><a href="<$MTEntryPermalink$>#more">Continue viewing "<$MTEntryTitle$>"</a></span><br />
           </MTEntryIfExtended>
           <div class="posted">Posted by <$MTEntryAuthor$> at <a href="<$MTEntryPermalink$>"><$MTEntryDate format="%X"$></a> <MTEntryIfAllowComments> | <a href="<$MTCGIPath$><$MTCommentScript$>?entry_id=<$MTEntryID$>" onclick="OpenComments(this.href); return false">Comments (<$MTEntryCommentCount$>)</a> </MTEntryIfAllowComments> <MTEntryIfAllowPings> | <a href="<$MTCGIPath$><$MTTrackbackScript$>?__mode=view&entry_id=<$MTEntryID$>" onclick="OpenTrackback(this.href); return false">TrackBack (<$MTEntryTrackbackCount$>)</a></MTEntryIfAllowPings><br>
             <span class="style3">>></span> <MTEntryCategories glue=" | ">
<a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$>
</a></MTEntryCategories></p>
         </div> </div>
         </MTEntries>
     </div></div>
  <p align="center"><MTArchivePrevious>
<a href="<$MTArchiveLink$>"><< <$MTArchiveTitle$></a> |
</MTArchivePrevious>
<a href="<$MTBlogURL$>">Main</a>
<MTArchiveNext>
| <a href="<$MTArchiveLink$>"><$MTArchiveTitle$> >></a>
</MTArchiveNext>
</p>


When I try to save the changes and rebuild, I get the following error message:

CODE
Build error in template 'Main Index': Error in <MTArchivePrevious> tag: You used an <MTArchivePrevious> without a date context set up.


I revisited the user manual and read the section about that tag again, however I don't really understand what I have done wrong. Hope someone can help!
kadyellebee
Savantpol, category archives don't have a date attached to them, so a previous archive won't work. That's why you are getting the error. Try modifying your Category Archives Template to be more along the lines of the default template. smile.gif

trinket, are you using that code on an Archive Template or an Index template? If its an index template, you might try wrapping the MTArchivePrevious through MTArchiveNext section in an MTArchiveList container like this:
CODE
<p align="center">
<MTArchiveList archive_type="Individual" lastn="1">
<MTArchivePrevious>
<a href="<$MTArchiveLink$>"><< <$MTArchiveTitle$></a> |
</MTArchivePrevious>
<a href="<$MTBlogURL$>">Main</a>
<MTArchiveNext>
| <a href="<$MTArchiveLink$>"><$MTArchiveTitle$> >></a>
</MTArchiveNext>
</MTArchiveList>
</p>


I didn't test it out, but that seems like it might do it. Otherwise, the MTEntryPrevious tag is probably gonna be helpful to you; just make sure that it goes inside of the MTEntries container.

Kristine
trinket
Thanks for your help smile.gif

I didn't have the code within the MTEntries container, so moved it on up there. I also tried the code you supplied, but got the following error:

CODE
Build error in template 'Main Index': Error in <MTEntries> tag: Error in <MTArchivePrevious> tag: <MTArchivePrevious> can be used only with Daily, Weekly, or Monthly archives.


If it wasn't so hot down here, I might be able to concentrate for 5 seconds. At the moment my brain is mush and I can't focus on this long enough to try and figure it out!
trinket
Still cant figure it out sad.gif
trinket
Still cant get it to work. I need to get this done ASAP so if someone can give me a solution, that would be great.
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-2010 Invision Power Services, Inc.