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


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


Thanks for this well-written guide. Drupal 6 + Permalink Module to show Comment ID in each comment

Thank you for your work on the blog! You're doing a good job!

Case study writing is a champion amongst the every now and again errands given to students all through the methodology of study. A carefully created detailed investigation can leave a continuing effect on your customer that deciphers into a whole deal relationship or affiliation. Case studies are intended for basic deduction and investigation of the students. A Custom Case Analysis requires profound comprehension of the current case and a great deal of time. A man needs to altogether read the case and need to answer the given inquiries effectively. In the event that the answers aren't right, it implies that the understudy was not able to comprehend the case appropriately. Henceforth, a thorough and cautious comprehension is all that much imperative. Writing a business case is likewise a meticulous and tedious errand and along these lines a considerable measure of students requires business case study help.

Visit here: http://www.essayscouncil.com

this is really great,unique and very informative post, i like it. thanks

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.