User account menu

  • Log in
BXTra.net

Breadcrumb

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

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

By BXTra | 4:12 AM PST, Thu January 03, 2013
Drupal

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
About text formats
  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

  • Will the router get the Openvpn as a client option?
    6 years ago
  • cancellation
    6 years 1 month ago
  • Router ASUS RT-N12 D1 tomatoes passwort falsch
    7 years 8 months ago
  • WPS button = 30/30/30 hard reset button
    7 years 9 months ago
  • Save my day!
    8 years 3 months ago
  • How to
    8 years 6 months ago
  • Can i still access my modem (the one with the ISP provided)?
    8 years 6 months ago
  • A saving step!
    8 years 10 months ago
  • Problem with Asus n12e-c1
    8 years 11 months ago
  • don't use Hostgator
    9 years 2 months ago

© 2007 - 2023 BXTra.net. All Rights Reserved. 
Certain other content, photos and artwork displayed on BXTra.net are protected by copyright and are the property of their respective owners.

Privacy Policy