Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I tried finding out how to fix my perl code problems on the MT site (moveabletype.org) but to no avail. I'm hoping I can ask here?

My blog: http://www.jessicamartin.org/blog

I am building my blog in a homogeneous fashion, meaning that the header and the footer on my blog will remain the same and the only things to change on my blog are 1) my left nav with my archives by the month and 2) the indvidual entry when a user clicks on a specific date.

My calendar is not behaving. This is what is going on 1) when I click on the archive months, the current month remains the same ?!? this defeats the purpose of clicking on the archive month to begin with. what should happen is, users should click on the archive month and that chosen month should replace the current month and 2) when i add test entries to the current month of may, the other entries in the month dont work at all. only the current entry works even when i click on other days of the month.

Here is the code that I am using for my left nav/archive/calendar include:

<div id="links"> <div align="center"> <table border="0" cellspacing="4" cellpadding="0" summary="Monthly cal +endar with links to each day's posts"> <caption class="calendarhead"><$MTDate format="%B %Y"$></caption> <tr> <th abbr="Sunday" align="center"><span class="calendar">Sun</span></th +> <th abbr="Monday" align="center"><span class="calendar">Mon</span></th +> <th abbr="Tuesday" align="center"><span class="calendar">Tue</span></t +h> <th abbr="Wednesday" align="center"><span class="calendar">Wed</span>< +/th> <th abbr="Thursday" align="center"><span class="calendar">Thu</span></ +th> <th abbr="Friday" align="center"><span class="calendar">Fri</span></th +> <th abbr="Saturday" align="center"><span class="calendar">Sat</span></ +th> </tr> <MTCalendar> <MTCalendarWeekHeader><tr></MTCalendarWeekHeader> <td align="center"><span class="calendar"> <MTCalendarIfEntries><MTEntries lastn="1"><a href="<$MTEntryPermalink$ +>"><$MTCalendarDay$></a></MTEntries></MTCalendarIfEntries><MTCalendar +IfNoEntries><$MTCalendarDay$></MTCalendarIfNoEntries><MTCalendarIfBla +nk> </MTCalendarIfBlank></span></td><MTCalendarWeekFooter></tr></MTCa +lendarWeekFooter></MTCalendar> </table> </div> <div class="sidetitle">Archives</div> <div class="side"> <MTArchiveList archive_type="Monthly"> <a href="<$MTArchiveLink$>"><$MTArchiveTitle$></a><br /> </MTArchiveList> </div> </div>

If this is not the right place to post this, please forgive. But if it is the right place, any help people can offer is greatly appreciated =)

-Jessica

20040520 Edit by Corion: Added formatting, linkified link

Replies are listed 'Best First'.
Re: MT perl question
by dragonchild (Archbishop) on May 20, 2004 at 20:23 UTC
    You're going to want to look at using some sort of templating system. I'd look at Template toolkit, but HTML::Template has a lot of adherents, as well. That will help separate out the display logic from the code logic.

    Also, you're going to want to learn how to debug a problem. This sounds like you're learning programming along with this, which is great. Debugging is an artform all of its own. Enjoy!

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

Re: MT perl question
by EdwardG (Vicar) on May 20, 2004 at 20:53 UTC

    Jessica,
    There are a few tricks that might help you to start debugging this problem for yourself. First, find some code that does do what you want, compare it with your code, see if you can spot an obvious difference. Second, take the working code and make small, incremental changes toward the code that you want. Keep testing with each step, and as soon as it breaks, you know you've gone wrong.

    It seems that at the moment you are trying to solve a problem that is too convoluted, too large to take in all at once. Follow the principle of insisting on bite-size pieces of the problem and things may be a lot easier.

    Debugging is not an easy skill to learn, but if you establish some guidelines like these, and stick to them, it won't be so impenetrable. You may even enjoy it.

    There are monks that may be able to glance at your problem and tell you the answer, maybe you will get an answer like this, but what will you learn? Nothing, and you won't have much fun beyond the immediate gratification.

    Best of luck, let us know how you get on.