April 29, 2004

Thingys & Doodads - IV

In this edition of Thingys & Doodads we'll look at an expanding / collapsing comment script from the Scripty Goddess.

This particular script is an "in-line" script for php sites. It will produce this:

Permalink | Show Comments(3) | Add Comment | Trackback(2)

Installation instructions:

Cut and paste the following code between the tags in every page that you want to utilize the script:

<!-- Begin Scripty Goddess Show/Hide Comments -->
<script type="text/javascript">
function showMoreComments(entryID, entryLink, htmlObj) {
extTextDivID = ('extText' + (entryID));
extLinkDivID = ('extLink' + (entryID));
if( document.getElementById ) {
if( document.getElementById(extTextDivID).style.display ) {
if( entryLink != 0 ) {
document.getElementById(extTextDivID).style.display = "block";
document.getElementById(extLinkDivID).style.display = "none";
htmlObj.blur();
} else {
document.getElementById(extTextDivID).style.display = "none";
document.getElementById(extLinkDivID).style.display = "block";
}
} else {
location.href = entryLink;
return true;
}
} else {
location.href = entryLink;
return true;
}
}
</script>
<!-- Begin Show/Hide Comments -->

Next, in the section of the Main Index Template, cut the code for the "posted by" section and paste the following code in:

<!-- Begin Scripty Goddess Show/Hide Comments -->
<div id="extLink<$MTEntryID$>">
<a href="<$MTEntryPermalink$>">Permalink</a>
<MTEntryIfAllowComments>
<?php if (<$MTEntryCommentCount$> > 0) { ?>
| <a href="<$MTEntryPermalink$>" name="ext<$MTEntryID pad="1"$>" onclick="showMoreComments(<$MTEntryID$>,'<$MTEntryPermalink$>', this);return false;">Show Comments (<$MTEntryCommentCount$>)</a>
<?php } ?>
| <a href="<$MTEntryPermalink$>#comments">Add your comment</a>
</MTEntryIfAllowComments>
<MTEntryIfAllowPings>
| <a href="<$MTCGIPath$><$MTTrackbackScript$>?__mode=view&entry_id=<$MTEntryID$>" onclick="OpenTrackback(this.href); return false">TrackBack (<$MTEntryTrackbackCount$>)</a>
</MTEntryIfAllowPings>
</div>
<div id="extText<$MTEntryID$>" style="display: none">
<a href="<$MTEntryPermalink$>">Permalink</a>
<MTEntryIfAllowComments>
| <a href="#ext<$MTEntryID pad="1"$>" onclick="showMoreComments(<$MTEntryID$>,0, this);return true;">Hide Comments</a>
| <a href="<$MTEntryPermalink$>#comments">Add your comment</a>
</MTEntryIfAllowComments>
<MTEntryIfAllowPings>
| <a href="<$MTCGIPath$><$MTTrackbackScript$>?__mode=view&entry_id=<$MTEntryID$>" onclick="OpenTrackback(this.href); return false">
TrackBack (<$MTEntryTrackbackCount$>)
</a>
</MTEntryIfAllowPings>
<MTEntryIfAllowComments>
<MTComments>
<$MTCommentBody$>
<p>Posted by <$MTCommentAuthorLink show_email="0"$> at <$MTCommentDate$></p><br>
</MTComments>
</MTEntryIfAllowComments>
<a href="<$MTEntryPermalink$>">Permalink</a>
<MTEntryIfAllowComments>
| <a href="#ext<$MTEntryID pad="1"$>" onclick="showMoreComments(<$MTEntryID$>,0, this);return true;">Hide Comments</a>
| <a href="<$MTEntryPermalink$>#comments">Add your comment</a>
</MTEntryIfAllowComments>
<MTEntryIfAllowPings>
| <a href="<$MTCGIPath$><$MTTrackbackScript$>?__mode=view&entry_id=<$MTEntryID$>" onclick="OpenTrackback(this.href); return false">TrackBack (<$MTEntryTrackbackCount$>)</a>
</MTEntryIfAllowPings>
</div>

As usual, you can edit any of the text labels to personalise the site with your own peculiar wit.

I have not tried this particular script so, if you have any problems installing it, go to the Scripty Goddess post and read the post and the following discussion thread.

Posted by Madfish Willie at April 29, 2004 10:22 PM
Comments
#1

Ooh, me likes.

Thanks!

BTW...does anyone know why the time on my blog is not reflective of the EST I programmed it to be in my blog config?

Posted by Linda at April 30, 2004 02:17 AM
#2

Me wonders exactly what the purpose of it is, as it seems to do what MT already does as far as I can tell, or maybe the example did not post correctly or is not displaying correctly for me.

Posted by Kang A. Roo at April 30, 2004 03:35 PM
#3

Put your glasses on and read it again.

Posted by Madfish Willie at April 30, 2004 04:41 PM
#4

Mr Madfish - how do we know if our site is php (ie that this will work on our site)?

Posted by Simon at May 6, 2004 03:48 AM
#5

It´s really a great joy being here. Your site is a varied mixture of the latest news, specified information and
activ power.

Posted by Cathy Lee at November 23, 2004 10:53 AM
#6

I love your site. It´s really a pleasure to read through all this interesting stuff and it home.

Posted by Jamie Lee at January 19, 2005 09:19 AM
#7

Hmm... nice site but be more informative!

Posted by Cari at July 15, 2005 12:02 PM
#8

WOW! I'll add your site to my bookmarks.

Posted by EroComix at July 19, 2005 01:03 AM
Live Comment Preview
Post a comment









Remember personal info?