Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-11-23 05:09:39

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Hack: comment_number

This is a quick n’ easy hack for comments.php that was inspired by the lack of access to per-comment data, the hack used for Gravatars, and looking at Jon Hicks’ comments markup. (please alert me if I’m ignoring some pre-packaged alternative that I should know by now). Keep in mind this hack will likely be resolved and unnecessary soon, but it’ll get ya by in the meantime.

Basically, I’ve always hated the number that ordered lists gives you; you have no control over how to style or position the number. So with a quick one-line addition to comments.php you can use:

<code><txp:comment_number /></code>

Open /textpattern/publish/comments.php & look for this line (~124):

<pre> $temp = preg_replace(‘/<(txp:comment_permlink)>(.*)<\/\\1>/U’, ‘<a href=”’.$dlink.’”>$2</a>’,$temp);
</pre>

Add this line:
<pre> $temp = str_replace( ‘<txp:comment_number />’,array_search($vars,$darr)+1,$temp );
</pre>

Voila! That’s all. Now you can use the individual comment number tag in your ‘comments’ form and it’ll replace that tag with the current comment number as it iterates through.

Edit: oh yeah, and just style your <code><ol></code> to “<code>list-style:none;</code>” to get rid of the default numbers.

Last edited by compooter (2004-11-23 06:06:58)

Offline

Board footer

Powered by FluxBB