Expandable Comments in Movable Type

This is an excerpt from a forum post that Kev made, it gives expandable comment capability to MT!

Author: CanuckKev
Subject: Collapsable Comments/Extended Entry
Posted: Sat Mar 06, 2004 11:59 pm (GMT 0)
Topic Replies: 0

I tried to make this a blog post, but it really screwed up the formating, so I decided to post it here.

The original code was take from this site and was modified by me.

First off, let me say that the following changes are made to your main template. Do not make any changes without making a backup first.

Now, on to the code. The first bit of code is added between the <head> and the </head> tags in your template.

Code:
<script language=”javascript” type=”text/javascript”>
function showMore(varA1, varB1){
var123 = (‘varXYZ’ + (varA1));
varABC = (‘varP’ + (varA1));
if( document.getElementById ) {
if( document.getElementById(var123).style.display ) {
if( varB1 != 0 ) {
document.getElementById(var123).style.display = “block”;
document.getElementById(varABC).style.display = “none”;
} else { document.getElementById(var123).style.display = “none”;
document.getElementById(varABC).style.display = “block”; }
} else { location.href = varB1;
return true; }
} else { location.href = varB1;
return true; }
}

function showMoreComments(varA12, varB12){
var1232 = (‘varXYZ2’ + (varA12));
varABC2 = (‘varP2’ + (varA12));
if( document.getElementById ) {
if( document.getElementById(var1232).style.display ) {
if( varB12 != 0 ) {
document.getElementById(var1232).style.display = “block”;
document.getElementById(varABC2).style.display = “none”;
} else { document.getElementById(var1232).style.display = “none”;
document.getElementById(varABC2).style.display = “block”; }
} else { location.href = varB12;
return true; }
} else { location.href = varB12;
return true; }
}
</script>

This provides us with the ability to have the collapsable comments and extended section.
Now, for the Extended Entry section, you need to replace the current code between the <MTEntryIfExtended> and </MTEntryIfExtended> section with the following:

Code:
<MTEntryIfExtended>
<span id=”varP<$MTEntryID$>”>
<a href=http://ronniewilliams.net/weblogs/”<$MTEntryLink$>#more<$MTEntryID pad=”1″$>” onclick=”showMore(<$MTEntryID$>,'<$MTEntryLink$>#more<$MTEntryID pad=”1″$>’);return false;”><p>Continue Reading “<em><$MTEntryTitle$></em>” »</p></a>
<br /></span>
<div id=”varXYZ<$MTEntryID$>” style=”display: none”><p><$MTEntryMore$></p><a href=http://ronniewilliams.net/weblogs/”#more<$MTEntryID pad=”1″$>” onclick=”showMore(<$MTEntryID$>,0);return
true;”><p>« All Done</p></a>
</div>
</MTEntryIfExtended>   

You will notice the following two parts:

Code:
<p>Continue Reading “<em><$MTEntryTitle$></em>” »</p>

and

Code:
<p>« All Done</p>

Both of these parts are displayed as the links to show and hide the extended entry. You may modify this to suit your needs.
Next is the code for the comments section. This will be placed between the <MTEntryIfAllowComments> and </MTEntryIfAllowComments> tags.

Code:
</MTEntryIfAllowComments>
<MTEntryIfAllowComments>
<span id=”varP2<$MTEntryID$>” class=”extended”><a href=http://ronniewilliams.net/weblogs/”<$MTEntryLink$>#comments<$MTEntryID pad=”1″$>” onclick=”showMoreComments(<$MTEntryID$>,'<$MTEntryLink$>#comments<$MTEntryID pad=”1″$>’);return false;”><p>There are (<$MTEntryCommentCount$>) Comments. <br>Show Comments here »</p></a><br />
</span><div id=”varXYZ2<$MTEntryID$>” style=”display: none”>
<MTComments>
<$MTCommentBody$>
<p>Posted by <$MTCommentAuthorLink$> at <$MTCommentDate$></p><br /><br />
</MTComments>
</MTEntryIfAllowComments>
<a href=http://ronniewilliams.net/weblogs/”#comments<$MTEntryID pad=”1″$>” onclick=”showMoreComments(<$MTEntryID$>,0);return
true;”><p>« Hide Comments</p></a></div>

You will notice the lines:

Code:
<p>There are (<$MTEntryCommentCount$>) Comments. <br>Show Comments here »</p>

and

Code:
<p>« Hide Comments</p>

They are the customized display for the show/hide comments. Customize to what you need.
I hope this helps, and you can see this in action on my site .
If you have any problems or questions with the code, post them. I’ll see what I can do to help.
_________________
Kevin aka:CanuckKev

It Doesn’t Matter… Just Ride!

7 comments

  1. or an incidental, can sometimes be hilary duff noticed and played up in the mix to paris hilton great effect. I’ll attest to all of brooke burke the above from experience. I can think carmen electra of another particularly helpful exercise, anna nicole smith though I wasn’t aware of it at the clay aiken time: I was, some years back, even svetlana khorkina MORE hypercritical of my own writing dragonball

  2. candid feet, nice pictures of street shoots, street feet, candids, in the street, feet in city,candid shots, candid photos,candid pics, streetshots fotos videos

  3. internet advertising internet advertising free advertising free advertising advertising specialties advertising specialties home depot home depot work at home work at home home based business home based business internet marketing internet marketing network marketing network marketing search engine marketing search engine marketing better business bureau better business bureau home based business home based business business cards business cards shopping cart shopping cart ecommerce shopping cart ecommerce shopping cart shopping cart software shopping cart software house plans house plans white house white house full house full house

  4. Pingback: Two Wheeled Rants

Comments are closed.