By LeMale on
Hi,
I'm looking for a safe way to change the "add new comment" link to something like "share you opinion about %node_title" .
I can change the link to something static like "share you opinion" but how to add a dynamic part like a node title ?
Regards,
Comments
.
Here's one way to do it:
Use String Overrides to change "add a comment" to "Share your opinion about". Then put the following code in your node.tpl.php file
.
Hello,
The result is not as expected :
When I see for links on $node, I have this :
There is no element "comment_add"
Any idea?
_
I realized that String Overrides might be not be the best solution, because it will change every instance of "add a comment" on your site.
The above code will print out the comment link outside of the $links variable. Could you copy paste the code you added and a bit of the surrounding code?
no other suggestions ?
no other suggestions ?
I Just solved this!
OK, so its not the best way to do it, but it doesn't require any code changes. First you'll need the following modules installed and activated:
Token - http://drupal.org/project/token
Custom Links - http://drupal.org/project/custom_links
String Overrides - http://drupal.org/project/stringoverrides
1. Use string override to rewrite the "Add new comment" link. String Override Admin UI is under site configuration. Punch the text of your comment link into the "Original" text box. Leave the replacement blank.
2. In Custom Links, under site building, click Add a new custom link.
3. Fill out the basic information, key, etc. that you want.
4. In the title, put something like "Comment on [title]". This uses the token module to place the title in the comment reply link text.
5. In path, put the full URL of your site, IE "http://www.example.com/comment/reply/[nid]#comment-form"
6. IMPORTANT: make sure that you use the FULL URL as the anchor link will be converted to %23 if you dont. For example if you use "comment/reply/[nid]#comment-form" it will be rendered by drupal to display as "http://www.example.com/comment/reply/[nid]%23comment-form" instead of "http://www.example.com/comment/reply/[nid]#comment-form"
of course replace http://www.example.com with your site URL.
You can even use the custom links key to theme the new link in your CSS files.
Flexible and should be exactly what you are looking for.
sda
hi man thanks alllot