August 02, 2006

Minx Comments - Everyone Wins Except The Spammers

Here's a quick rundown on how to create your own Minx-based comments pages.

First, you need to change your comments links from, well, whatever they are now, to:

<a href="http://minx.cc/?post=<$MTEntryID$>">Comments</a>
Or something similar. http://minx.cc?post=XXXXXX is a link that works for any given entry to bring up that entry and its comments.

Well, it shouldn't work on unpublished entries. Let me check that...

Hmm. Well, that's not quite right. You can't see the post, but it gives you a comment form. I'll fix that.

...

Done.

Anyway, the template looks like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html><head>
<title>[posts][post.title][/posts] </title>
<link rel="stylesheet" href="http://minx.cc/css/minx.css" type="text/css" />
<script language="JavaScript" src="http://minx.cc/scripts/showhide.js"></script>
</head>

<body>

<div id="container">
<div id="center">
<div class="content">

[posts]<h1>[post.title]</h1><p>
[post.text]
<p>
[post.more]

<p class="posted">
Posted by: [post.authorlink] at
<a href="[post.url]">[post.time]</a>
</p>
<p><h1>Comments</h1>
<p>
[comments:here]
<p>
[include commentform]
[/posts]

[magic.pager]
[magic.stats]

</div>
</div>
</div>

<div style="clear: both;"> </div>

</body>
</html>

Got all that?

No?

Okay, let's take it a bit at a time.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
This tells the browser that the page is to be interpreted as XHTML. Whether it is valid XHTML or not depends on the template, but if you don't put this line in some funny things happen with the current stylesheet.
<html><head>
<title>[posts][post.title][/posts] </title>
<link rel="stylesheet" href="http://minx.cc/css/minx.css" type="text/css" />
<script language="JavaScript" src="http://minx.cc/scripts/showhide.js"></script>
</head>
The HTML head section.

The title line just puts the title of the post as the title on the browser window.
The next two lines pull in the CSS (stylesheet) - replace this with your own CSS; and the standard show/hide comments thingy.

Which this page doesn't actually use, so we might as well remove it.

Anyway:

<body>

<div id="container">
<div id="center">
<div class="content">

The start of the body of the page. The DIVs depend on your stylesheet; you should be able to get an idea of what to put here by looking at your existing comments page.
[posts]
The start of the posts block. Post-related tags are only guaranteed to work inside a posts block.
<h1>[post.title]</h1><p>
Display the title, nice and big.
[post.text]
<p>
[post.more]
Display the post body, then a paragraph break, then the extended post (if there is any). If there isn't an extended post, your page should still look nice and tidy.
<p class="posted">
Posted by: [post.authorlink] at
<a href="[post.url]">[post.time]</a>
</p>
Show that "Posted by" line.
<p><h1>Comments</h1>
<p>
A line that says "Comments" in nice big letters.
[comments:here]
Put the comments here. (Hey, this stuff is easy!)
[include commentform]
Include the comment form.
[/posts]
Don't forget to close whatever you opened!
[magic.pager]
You only really need this if you are going for paged comments, which don't work right now anyway.
[magic.stats]
Show performance statistics. You don't really need this at all... But it's cute.
</div>
</div>
</div>

<div style="clear: both;"> </div>

</body>
</html>

And close everything else. Yay!

Easy, huh? All you need to do is save this as a new index template called page.entry... And wait for me to fix things so that Minx looks for the page.entry template instead of the mxEntry template. And viola!

Posted by Pixy Misa at August 2, 2006 04:36 AM | TrackBack
Comments
#1

Now -- when i do this, what happens to my old comments? Do they still exist?

Posted by Rhymes With Right at August 2, 2006 10:02 PM
#2

And before i rebuild, I must ask -- should it be page.entry.php as teh file name -- or something else?

Posted by Rhymes With Right at August 2, 2006 10:30 PM
#3

Good questions! :D

1. Nothing happens to your old comments! Minx keeps your old comments! (Neat, huh?)

2. You don't need a file name at all. And turn that little auto-rebuild thingy off for the new template.

Posted by Pixy Misa at August 2, 2006 11:37 PM
#4

Ok, so we don't need a file name at all, so why do you say "All you need to do is save this as a new index template called page.entry... And wait for me to fix things so that Minx looks for the page.entry template instead of the mxEntry template. And viola!"

At the end of your post? I'm a little confused, do we actually only have to change the comments links?

Posted by Oorgo at August 4, 2006 06:18 PM
#5

Sorry, I don't understand. Am I supposed to replace the main index template with this code? If I do that, how will it be saved as "page.entry"? Won't this code simply replace the code that's there?

I'm sort of hopelessly confused.

Also, I made some changes to the main index template awhile back that turned off comments after a certain number of days, and also turned off comments for old posts. Does this code interfere with that?

Oh, I get it. I just change the name of the output file when saving the main index template from "index.php" to "page.entry", right? Tell me that's right, because that's what I did. You know... so I can sleep at least.

Posted by Demosophist at August 7, 2006 02:42 AM
Live Comment Preview
Post a comment









Remember personal info?