Drupal 6 + Permalink Module to show Comment ID in each comment

Category:

With Permalink module, I can have the real link to the comment. Without Permalink, the comment link will not work correctly with multiple comment pages.  It will always link you to the first page of that node (In this case, node 33034) if that comment you are looking for is not on the first page. The comment link will be like below :

  • Without Permalink -> http://www.bxtra.net/node/33034#comment-45673
  • With Permalink -> http://www.bxtra.net/comment/45673#comment-45673

Permalink is great but when it display the link, it will only show the word Permalink which is good but I also would like it to display the comment id which is #45673.  With Comment ID in each comment, user knows and can refer to the comment easily. It does not need to go into order start from 1 in every node. I want to use just the real Comment ID (cid) which is good enough.  However, I don't see anyway to do that via Permalink module.

What I did to make it works is to replace text in the Permalink variable ( $permalink) with the comment ID using str_replace. Then, print it out in the theme file comment.tpl.php.  Below is the small code to make it work :

    <?php $permalink_number = str_replace("Permalink", $comment->cid, $permalink); ?>
    <?php print '#'.$permalink_number; ?>

 

Software Tested :

  • Pressflow 6.26
  • Permalink 6.x-1.6
  • Zen Theme 1.2

Comments

I think this is a better than average article. You make this data intriguing and locks in. You give per-users a ton to consider and I welcome that sort of composing.
https://mightyessays.com/

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.