default userpic

Calendar "previous month" and "next month" arrows?

Vote 0 Votes

Newbie here. Can someone point me to instructions on how I can add “previous month” and “next month” navigation arrows to the Calendar widget?

Thanks in advance for any help!

Reported on Movable Type 4.2

13 Replies

| Add a Reply
  • This might work

        <mt:ArchiveNext type="Monthly">
          <a href="<$mt:ArchiveLink$>"
            title="<$mt:ArchiveTitle escape="html"$>">Next</a>
        <mt:Else>
           <!-- output when no next archive is available -->
        </mt:ArchiveNext>
    
  • No dice. Here's the error I get when I try to publish the site:

    An error occurred publishing category '3':
    Publish error in template 'Category Entry Listing':
    Error in tag: error in module Sidebar:
    Publish error in template 'Sidebar':
    Error in tag: Error in tag:
    Error in tag:
    error in widget Calendar:
    Publish error in template 'Calendar':
    Error in tag:
    Error in tag:
    You used an MTarchiveprevious tag without a date context set up.

    Any thoughts?

  • Can you post your code for the calendar widget template.

  • <mt:IfArchiveTypeEnabled archive_type="Individual">
    <div class="widget-calendar widget">
    
    


    <h3 class="widget-header">


    <mt:ArchivePrevious type="Monthly">
    <a href="<$mt:ArchiveLink$>"
    title="<$mt:ArchiveTitle escape="html"$>">&laquo;</a>
    <mt:Else>
    <!-- output when no previous archive is available -->
    </mt:ArchivePrevious>


    <$mt:Date format="%B %Y"$>


    <mt:ArchiveNext type="Monthly">
    <a href="<$mt:ArchiveLink$>"
    title="<$mt:ArchiveTitle escape="html"$>">&raquo;</a>
    <mt:Else>
    <!-- output when no next archive is available -->
    </mt:ArchiveNext>


    </h3>

    <div class="widget-content">
    <table summary="Monthly calendar with links to daily posts">
    <tr>
    <th abbr="Sunday">Sun</th>
    <th abbr="Monday">Mon</th>
    <th abbr="Tuesday">Tue</th>
    <th abbr="Wednesday">Wed</th>
    <th abbr="Thursday">Thu</th>
    <th abbr="Friday">Fri</th>
    <th abbr="Saturday">Sat</th>
    </tr>
    <mt:Calendar>
    <mt:CalendarWeekHeader>
    <tr>
    </mt:CalendarWeekHeader>
    <td>
    <mt:CalendarIfEntries>
    <mt:Entries lastn="1">
    <a href="<$mt:EntryPermalink$>"><$mt:CalendarDay$></a>
    </mt:Entries>
    </mt:CalendarIfEntries>
    <mt:CalendarIfNoEntries>
    <$mt:CalendarDay$>
    </mt:CalendarIfNoEntries>
    <mt:CalendarIfBlank>&nbsp;</mt:CalendarIfBlank>
    </td>
    <mt:CalendarWeekFooter>
    </tr>
    </mt:CalendarWeekFooter>
    </mt:Calendar>
    </table>
    </div>
    </div>
    </mt:IfArchiveTypeEnabled>

  • Try moving the next | previous code so that it is within the <mt:Calendar> tag block.

  • Nope, same error. I put the blocks just inside the end of the mt:Calendar block.

  • FogBugs case 91780 added (feature request submitted). Thank you for your help.

  • default userpic

    hey folks!

    I just started using MT, and I am going through the same thing trying to create an archive calendar.

    This post was very helpful. but I'm now getting an error.

    Publish error in template 'Main Index': Error in tag: error in module CalendarArchive: Error in tag: You used an MTarchiveprevious tag without a date context set up.

    I'm posting the whole code for anyone who is interested:

    <!--module: CalendarArchive-->
    <h2> Archives </h2>
    <div class="module-calendar module">
    <h3 class="module-header">
    <caption style="text-align:left;">
    <mt:ArchivePrevious archive_type="Monthly"><a href="<$mt:ArchiveLink$>" title="<$mt:Date format="%B"$>">&laquo;</a> &nbsp; </mt:ArchivePrevious>
    <a href="<$MTBlogArchiveURL$><$mt:Date format="%Y/%m/"$>"><$mt:Date format="%B %Y"$></a>
    <mt:ArchiveNext archive_type="Monthly"> &nbsp; <a href="<$mt:ArchiveLink$>" title="<$mt:Date format="%B"$>">&raquo;</a></mt:ArchiveNext>
    </caption>
    </h3>
    <div class="module-content">
    <table summary="Monthly calendar with links to each day's posts">
    <tr>
    <th abbr="Sunday">Sun</th>
    <th abbr="Monday">Mon</th>
    <th abbr="Tuesday">Tue</th>
    <th abbr="Wednesday">Wed</th>
    <th abbr="Thursday">Thu</th>
    <th abbr="Friday">Fri</th>
    <th abbr="Saturday">Sat</th>
    </tr>
    <MTCalendar>
    <MTCalendarWeekHeader>
    <tr>
    </MTCalendarWeekHeader>
    <td>
    <MTCalendarIfEntries>
    <MTEntries lastn="1">
    <a href="<$MTEntryPermalink$>"><$MTCalendarDay$></a>
    </MTEntries>
    </MTCalendarIfEntries>
    <MTCalendarIfNoEntries>
    <$MTCalendarDay$>
    </MTCalendarIfNoEntries>
    <MTCalendarIfBlank>&nbsp;</MTCalendarIfBlank>
    </td>
    <MTCalendarWeekFooter>
    </tr>
    </MTCalendarWeekFooter>
    </MTCalendar>
    </table>
    </div>
    </div>

    <!--/module: CalendarArchive-->

    apologies for the look of the code. for some reason the "pre" tags aren't working?

    any tips would be appreciated.

    and ya, why aren't the previous/next links part of the regular code?

    and one off the cuff question for a MT beginner: What's the difference between a Module and a Widget?

    Thanks!

  • i'm pretty sure that was the same error i got. but so that other people can help us out, you may want to use the special form to attach your code so that the code itself is legible.

    as far as your question, "and one off the cuff question for a MT beginner: What's the difference between a Module and a Widget?", please don't threadjack, or else this thread will get off the topic. please post that in a new thread. thanks.

  • I really need the same. The archive_type modifier does not work as expected. It should always display a next or previous month if there is one and not throw a 'not in date context' error if it's a main index or individual post.

    On top of that, the manual states that type and archive_type are the same modifiers. But they have different results. type produces an out of date context error on individual entries, not on main indexes, archive_type vice versa. In both cases a link to next/previous month should be given, since you specifically request for a monthly context.

    This makes the calender function severely limited imo

  • I've found the solution:

    <mt:If name="datebased_archive">
    <div id="next-prev">
    <div id="prev"><mt:ArchivePrevious archive_type="Monthly"><a href="<$mt:ArchiveLink$>"><$mt:ArchiveTitle$> »</a></mt:ArchivePrevious></div>
    <div id="next"><mt:archivenext archive_type="Monthly"><a href="<$mt:ArchiveLink$>">« <$mt:ArchiveTitle$></a></mt:ArchiveNext></div>
    </div>
    <mt:else>
    <mt:archivelist archive_type="Monthly" lastn="1">
    <div id="next-prev">
    <div id="prev"><mt:ArchivePrevious archive_type="Monthly"><a href="<$mt:ArchiveLink$>"><$mt:ArchiveTitle$> »</a></mt:ArchivePrevious></div>
    <div id="next"><mt:archivenext archive_type="Monthly"><a href="<$mt:ArchiveLink$>">« <$mt:ArchiveTitle$></a></mt:ArchiveNext></div>
    </div></mt:archivelist>
    </mt:else>
    </mt:if>

    Works perfectly

  • Hm, works perfectly instead within the context of an individual entry. Once you click on an individual entry, the next month/previous month will result in only the previous month being linked to the previous month of the current date (in reality). It does not generate a next/prev month in respect to the date of the entry.

    No way to create an archive-context in this example right?

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

1195 3842

Last Topic: Comment form customization by anisa on Feb 8, 2010

60 184

Last Topic: Dynamic Publishing - Blank Screen by Sivaram M on Dec 15, 2009

955 2985

Last Topic: MT5 - Cookie Problems by Dave Cross on Feb 9, 2010

68 213

Last Topic: How to add Custom Fields by gregoryttp on Feb 5, 2010

19 67

Last Topic: Custom main index page by Richard on Feb 7, 2010

42 169

Last Topic: I want to write my own wordpress plugin by Xarzu on Jan 31, 2010

11 21

Last Topic: Monthly Calendars Help Needed by joe leblanc on Jan 19, 2010

91 326

Last Topic: SpamLookup Keyword Filter 2.1 not work by b.n09 on Nov 17, 2009

52 178

Last Topic: Assets - No options by Chelle on Feb 5, 2010

code.sixapart.com

128 444

Last Topic: ActionStream with Movable Type 5.01 by Parneix on Jan 24, 2010

154 468

Last Topic: URGENT! Help needed w/ Virus by PhilContrino on Feb 1, 2010