Help - Search - Members - Calendar
Full Version: Comments in a Pop-up Box?
Movable Type Community Forum > Additional Resources > Tips and Tricks
Jenipurr
On the default template, the comments are listed beneath each entry. I'd like to have just a 'comments' button or something at the bottom, and have the comments (listed and new comments entered) in a pop-up box like I've seen done in other journals. I can't see anything in the configuration list that changes that so I have to assume it has something to do with the code on the entry template (?).

thanks,

Jenipurr
http://www.jenipurr.com/meow
almuhajabah
Yes, you'll need to modify your individual entry archive template. If you have pop-up comments on your blog's index page you can copy the code from there (be sure to include the javascript code for the pop-up that appears in the <head> section).
Jenipurr
Um. Okay. So. No entries ever show up on my index page, since all it does is list the last 10 titles/dates, and I only ever show entries on individual archive pages. And when I transferred in my template for the entries, I sort of accidently deleted all the commenting code anyway. I know I can get that from the basic templates page so that's not so much the issue....so all I do is copy the comment code from the main index to my individual archive template and it will work? As a pop-up?

Jenipurr
http://www.jenipurr.com/meow
almuhajabah
OK, your site is different than I thought. I didn't check your page before I posted, which I should have done.

In the <head> section of your individual entry archive template, put the following:

CODE
<script language="javascript" type="text/javascript">
function OpenComments (c) {
   window.open(c,
                   'comments',
                   'width=480,height=480,scrollbars=yes,status=yes');
}

</script>


Then, where you want to put the link to the comments pop-up, put the following:

CODE
<MTEntryIfAllowComments>
    | <a href="<$MTCGIPath$><$MTCommentScript$>?entry_id=<$MTEntryID$>" onclick="OpenComments(this.href); return false">Comments (<$MTEntryCommentCount$>)</a>
    </MTEntryIfAllowComments>


Sorry for not giving better instructions for you  huh.gif
Jenipurr
Thanks! Okay, code added, pop-up box appears....but it displays my main index! Hmm. I never modified the template code for any of the comment templates, so I have a feeling I probably did something wrong here. My apologies for what is probably a very silly question on the whole thing - HTML I can do, but I don't speak javascript too well.  :)

Jenipurr
http://www.jenipurr.com/meow
almuhajabah
The part of the code that determines what appears in the pop-up window is:

CODE
<a href="<$MTCGIPath$><$MTCommentScript$>?entry_id=<$MTEntryID$>"


If you're using an older version of MT, you might need to replace <$MTCommentScript$> with mt-comments.cgi
Jenipurr
i'm running the latest version (2.2). Tried the replacement and I just get an error.

Is there something I need to set up on the comments templates themselves to make this work? Those haven't been touched since I installed MT.

Jenipurr
http://www.jenipurr.com/meow
almuhajabah
Uh, the latest version of MT is 2.51 (in fact, version 2.6 is promised in a couple of weeks).

I noticed that your link has a space after mt-comments.cgi and before the question mark. Try removing the space and see if that works better.
Jenipurr
Well, it *would* be something as silly as an extra space. I've got a comments pop-up - thanks!! Now I can go happily mucking with the comments template....but I think I'll just go very, very carefully.

Again, thanks for the help.

Jenipurr
http://www.jenipurr.com/meow
almuhajabah
I know that I've stared at silly typographical errors for hours and not seen them. That's why it helps to have an extra pair of eyes.  :)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.