Edit 2010-04-20: A year and a half after implementing Mid Century, while playing with Byrne Reese’s Mid Century 2.0 I was having these same issues. I let him know and he tells me that the Mid Century AJAX requires the option “Use Comment Confirmation Page” to be turned on under commenting preferences. Bingo! Now everything works. Probably would have fixed it here too, so if you’re having commenting issues with Mid Century, try that first.
Edit 2008-11-26: I added a download file to make it easier and clarified the instructions.
When I changed over to Mid-Century, I had some goofy things happening with commenting. It seemed related to the AJAX that powered commenting in Mid-Century.
In theory, the AJAX is pretty cool. When a comment is posted, the entire page doesn’t get rebuilt, only the comment section. The new comment is then highlighted in yellow, which is neat. In practice, it didn’t work at all on my site and adding my Google Analytics code really messed it up. I decided the AJAX magic wasn’t worth it, so I went looking for ways to de-AJAX.
Help wasn’t very forthcoming from the MT Forums or Jim Ramsey, the developer of Mid-Century (hey, people are busy), so I did some detective work.
I created a test blog and loaded the Classic Blog template set to compare Mid-Century to the default templates. I found that the two template sets to be very similar, with Mid-Century having a few more template modules and an additional javascript index template. Of course, the template content is very different, but the template listings are similar. The problem was in the ‘Comments’ template module.
I loaded each into EditPad Pro and hitting ‘compare files’ I found a lot of differences. Digging further, I found that most were due to Mid-Century using old syntax for some MT tags and Mid-Century having an ‘Individual Comment’ module that was included into the ‘Comments’ module. Reconciling those differences revealed a couple additional div tags and two script tag differences. The script tags was what I was looking for.
Mid-Century has a long additional script tag just after the ‘Comment Greeting’ div and before the form tag. It’s also missing the script from the end of the Classic Blog ‘Comments’ template, just before the closing ‘mt:IfCommentsAccepted’ tag. Fixing this removed the AJAX and made commenting worked as expected again.
While that worked, commenting was fine and the page loaded fine, I did notice that it generated a JavaScript error related to the ‘mtEntryOnUnload’ function. The JavaScript is generated by an index template named, cleverly, ‘JavaScript’. After comparing the Mid-Century JavaScript template to the Classic Blog JavaScript template, I found several variations (the template is 800+ lines), at least one relating to the ‘mtEntryOnUnload’ function. I don’t know JavaScript, but I figured I could replace the Mid-Centurry file with the lassic Blog file and see what happens, backing up the original first. I gave it a shot and it worked, no more JavaScript errors.
So, removing AJAX is fairly easy. I made a duplicate of my original JavaScript & Comments templates in MT before I started, just in case. Here are the changes you need to make:
- In your Mid-Century ‘Comments’ template module, comment or delete the long script tag just before the form tag.
- Also in your Mid-Century ‘Comments’ template module, add the short, 6 line script tag from the Classic Blog ‘Comments’ template module, just before the closing ‘mt:IfCommentsAccepted’ tag.
- Swap out the contents of the MidCentury JavaScript template for the contents of the Classic Blog JavaScript template.
So you don’t have to create a new blog to get the Classic Blog template content, you can find the added content in this text file.
That’s it, now your Mid-Century comment system is de-AJAX’ed.
Recent Comments