Content last modified Monday 6 March 2017
hop to #bottom
About It:
Rate it:
  • Helpful?
  • 0 Yes
  • 0 No
Flag it:

If you'd like to provide updated information and do not have access to directly edit, please contact the site admin; thanks!

Put comments anywhere on an article page

A.K.A. “How to seperate articles from discussion”

Seriously though, this is a dead easy hack to Textpattern that will let you have your comments anywhere on an article page—not just tacked onto the bottom of the text like the default behaviour. See this site for an example—the comments appear in a completely different part of the page (in the code, anyway).

There are two main pieces to this puzzle. The hack and the plugin. First, the hack.

Easiest Hack Ever.

Find the following code in publish.php, at around line 387 – it’s at the end of the doArticle() function.

Now just comment it out. Or delete it, if it has offended your mother. That’s it! The difficult bit is out’ve the way! Take 5, then come back for the challenge that is the rest of this howto…

Plugin A-Go-Go

Here’s the code for the plugin:

Install that into Textpattern. This will give you a new tag <txp:post_comments />. Guess what it does? Go on, guess! That’s right, it outputs the comments and comment form!

Finishing Up.

All that’s left to do, is to place this tag on the page. To do this, pick a spot – any spot will do – and add the tag. You’ll want to surround it with <txp:if_individual_article> tag so that it’s only displayed on an article page. If you don’t, you’ll most likely get a load of errors.

There, that was easy, wasn’t it? It didn’t take long and you’ve just opened up a whole load of layout possibilities that you didn’t have before!

Article Request Count:
Initially released:
12th January 2005
Posted here:
20 Mar 2005
Article modified:
11 Apr 2005

If there is a comment form at the Information URL, you may want to leave your comments/questions there for quicker feedback. Otherwise, comment away:

Commenting is closed for this article.

Commented (6)

i wasn’t sure what to do with the uncompiled plugin code..
Rob(Wilshire) talked me through how to compile a plugin (used zem_tpl).

Chris may decide he wants to compile the plugin himself and make that available at some point… meanwhile, i hope it’s okay that i’ve made my compiled version of his code available..

i’ve called it cml_post_comments
also see low_discuss for a fully plugined version of this functionality
The comments looked like they were at the bottom of the page in your example website. I don’t see how this is different from where comments are normally placed. Do you have any other examples?

Also, why would you want visitor comments in the middle of the page?
I don’t know about the example page up there, but for example, sidulus puts comments on the right of articles (best viewed with a wide browser window).

Basically the idea is that you can opt to put the comments anywhere that you want. if you want them on the bottom, that’s fine too. i think there’s a new feature being built into textpattern that will allow you to put the tag to output comments anywhere on the page.
“Basically the idea is that you can opt to put the comments anywhere that you want” – greit idyll, but …
Robert Walgate:

I’d like to use this facility, but where has the plugin code gone? There is now just a blank space and the info URL is dead. Has it been removed? Was it buggy?

Subscribe to this article's comments RSS feed. [ ? ]   View Recent Comments across the site.

Would you care to write a comment?

You know you want to visit the Archives.




There are also tag clouds, 'cause those are fun.
Published with Textpattern