Help - Search - Members - Calendar
Full Version: Lightbox And Creating .htm Comments Page
Movable Type Community Forum > Using Movable Type > Commenting System
medhus
I have a rather specific problem -- I'm trying to implement Lightbox (actually Thickbox which is a variant) which uses AJAX to display those cool "alternative" pop up windows that overlay in the same window. (Thickbox info: here)

The problem is, like an iframe, it calls an external page and displays the information in the same window dynamically--but it won't support .cgi files, so my comments page is ruled out. I don't use individual archive-style comments, they are all located in popups. I'm trying to eliminate this by using this alternative popup system.

Basically, I need to create an .htm file (php is not compatible either) that is basically an exact replica of the popup comments .cgi page. When I tried to copy and paste relevant elements, it works fine and posting a comment works flawlessly, but with one major flaw: no matter what page I am on (individual), the comments page only displays the comments for the most CURRENT entry, i.e. if I'm on entry 152 and the most current is 455, comments page called via AJAX will show comments for #455 instead of #152.

Why is this happening, and how do I make comments pages that work for each entry? Is this possible?

If not, is there a way to include the .cgi file IN an .htm file? It doesn't matter as long as I can get the comments showing up for the correct entry.

My test page that wants this to happen: http://www.eightyfour.net/testing.php (note that the comments will show up fine for the current entry, but not for previous entries, which would not be testing.php if you get my drift)
my would-be comments page for now: http://www.eightyfour.net/thickbox.htm
The code for Thickbox:
http://www.eightyfour.net/global.js
http://www.eightyfour.net/thickbox.js
http://www.eightyfour.net/jquery.js

Any help from the MT Gurus & Goddesses would be much, much appreciated. huh.gif

-Kristina
lisa
You could create a new Template > Archives > Comments template that contains the layout as you'd like it.

Then you could go to Settings > Publishing > Archive Mapping and add a new Individual map that points to your new "Comments" template. Instead of using the same Archive File Path, you would want to change the %e.html to %e-comments.html.

Then point your AJAX box to that page. smile.gif
medhus
Great! I'll try that out and let you know if it works. Thanks Lisa!

One rather clunky solution I have in mind if all else fails is to have the .htm page load an iframe with the cgi page inside of it. Wonder if that would work (if all else fails of course, as this solution is not as elegant as yours!)
medhus
Hmm I'm not entirely sure where those options are--I'm running 3.15 if that's the reason. No "settings -> publishing" menu here. (?)
lisa
I don't recall where the settings are in 3.15. Look under Weblog Config or Core Config.
medhus
This is the closest thing I have to archive styling and such, what do you think? Sorry about my antiquated version, I just have some modifications to it that i would lose if I upgraded. smile.gif Eventually though!

QUOTE
Archive Files

This screen allows you to enable or disable archive types and assign one or more templates to each archive. For example, you may want to create two different views of your monthly archives: one in which the entries for a particular month are presented as a list, and the other representing the entries in a calendar view of that month.
Create A New Template/Archive Type Association

Select the type of archive you want to create, then choose which template to associate with that archive type. Finally, click the Add button. The new archive will be shown in the table below.

Archive Type: Individual  Template:  Individual Entry Archive [add] (button)


Archives

In the table below you can enable or disable each archive type, customize the output path for each archive template, select a preferred template for each archive type, or delete any template from an archive type.
Archive Types  Template ?                    Archive File Template ?  Preferred  Delete
Individual        Individual Entry Archive   


Again, thanks so much for your help and patience! smile.gif
lisa
Yup, those are the 2 sections you need. You want to create a new Archive Template on your Templates page and then use that in the mappings that you mention - using Individual and the new template you've created.
medhus
Excellent! I've created a new archive template "Thickbox", saved it, then went to that config area and added a new "Individual" type and selected the "Thickbox" template and pushed the Add button. I did not select it as the preferred archive format, since individual archives are important for me (it's a photoblog). In the formatting of the pages I named them as you suggested, %e-comments.htm (dropped the l).

Rebuilt, and such--now when I call the AJAX box in my preferred/original individual archive template, I'll direct it to "%e-comments.htm"? Or is an entry ID or permalink needed in there somewhere?

Thanks so much for your wise input Lisa! biggrin.gif
medhus
Alright so I have the comments file template labeled <$MTEntryID pad="1"$>-comments.htm

It works smoothly and I got the link to the AJAX call sorted out, but it still shows up only the comments for the most recent entry, no matter what old entry I am on. In fact, it's not that it calls up the most recent ...-comments.htm page, but rather when I look at ALL -comments.htm pages created, they all show the comments for only the specific latest entry.

Take a look: http://www.eightyfour.net/ and click previous, then check out those comments. Bizarre?

I need the template page for ...-comments.htm to be entry specific. Hmm.
medhus
Gar, I fixed it. It turns out on the "Thickbox" archive template, I had
CODE
<MTEntries lastn="1">
there leftover from the testing phase. Phew.

Thanks SO much for your wonderful insight Lisa!

LAST question, I swear:
1) When a comment is posted, directs to the actual .cgi page for the entry comments--any way to get it to just redirect back to the original entry commented on?

2) I have styleswitches, and the page doesn't recognize the cookie (or maybe doesn't refresh enough?) if I switch a style, for example If I switch from white to black, it stays in the white style, even though the other pages show up in black style, etc. Strange?

Thank you, thank you, thank you!!
medhus
Okay the problem about the redirect has been solved.

I searched through this forum and found that some people used the "static" tag value="0" to redirect to the same comments page (cgi) so i figured setting mine from 0 to 1 would do the opposite, and it worked! It now redirects to the entry page after a comment is submitted. Perfect!

Now I'm still having a problem with cookie recognition though...including style cookie AND remembering info in the form. huh.gif
medhus
anyone? *bump*
lisa
Hi again,

I had some time off over the weekend. I'm glad you got the thickbox widget working. It looks pretty cool.

In your new comments template, you'll need to add:
CODE
<script type="text/javascript" src="<$MTBlogURL$>mt-site.js"></script>


And you'll want to change your <body> tag to:
CODE
<body onload="individualArchivesOnLoad(commenter_name)">


That should fix the cookie issue. I'm not sure what you mean about the style cookie though.

Lisa
medhus
Thanks very much Lisa! Hope you had a great weekend. smile.gif

I've implemented that now and I'm going to play around with it to test it in various "scenarios". I'm sure it will work beautifully--and I owe everything to you!

By the style cookie, I don't know if you've seen this but it's where visitors can dynamically (via javascript) change to an alternate stylesheet to change the skin or colors of the website. This sets a cookie that will remember that user's preference until he/she changes it again.

The code should be in the source somewhere, on any page, but it seems that is not being remembered--is there another onLoad event I should add for another cookie, or is that site-specific? Either way I know this isn't under the branch of Movable type, but if you or anyone else has any gem of information I'd love to try it out. smile.gif Thanks again!!

EDIT: Thought I should note that the cookie for the style has always been read by Safari but oddly not any Gecko based browser (Firefox or Camino, virtually the same thing except for OS integration). I would think it to be the other way around, but this is just one of those things, straight from the "twilight zone". mellow.gif
lisa
Ohhhh. Those are the little black and white boxes in the right corner then? tongue.gif I wondered what they were about and figured it was a design element.

Could you give me the direct link to one of your comment pages? Does the style "stick" if you access it directly without the neat box code?
medhus
Hmm, maybe I should make those boxes more informative! Good call on that...

Yes, the interesting thing is if it's called directly via inputting the URL of one of the pages, the style sticks! Just not when called inside a page.

Here's an example page: (may want to visit my homepage first to set a style then click this url) http://www.eightyfour.net/mt/archives/pixe...37-comments.htm
lisa
In IE, I'm seeing a Javascript error on your main page as well as the comment page (when accessed directly). You may want to research that to see if that's the cause of the style not sticking.

Good luck though! smile.gif
rambohoho
hi everyone, I tried to follow the posts of you guy coz i have the same problem. but i still can't figure out why my comment page displays nothing.

here's the link.
http://www.rambohoho.com/blog/archives/20080804192332.php

here's what i've done.

I created a new page in archive template as "entry", then created an archive mapping. with the path name '%e-comments.php'
[img]http://www.rambohoho.com/misc/images/create_archive_mapping.png[/img]

the new page hast the same header as the individual entry page, they only differ from the <body>! in the <body> tag i copied the default template for comments there.

then I've linked the comment button to '../<$MTEntryID pad="1"$>-comments.php'

can any one tell me where i have done wrong.

thank you!!
rambohoho
[img]http://rambohoho.com/misc/images/mt_allow_anonymous_comments.png[/img]

I've solved it. hehe
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.