Content last modified Tuesday 24 August 2021
hop to #bottom
Categories:
Author:
About It:
Rate it:
  • Helpful?
  • 0 Yes
  • 2 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:
21 Mar 2005

You know you want to visit the Archives.
Published with Textpattern