By mpg on
Please help,
I would like to change the "comment" link depending on the page i am on.
The comments module is used for the blog, forum, reviews etc. and i would like to change the "comment" link based on the page. So if a page had reviews, the link would say "review this item" or on the blog page it would read "comment on this blog" etc.
Can some one tell me how to accomplish this in 5.5 or what the possibilities are...
thank you.
Comments
please help!
bump
Please help
Please help
I found this code and tried it in 5.5 and it did not work, it just added another comment link with the original comment title:
-------------------------------------------------------------------------------------------------------------
I don't like the link title "add new comment", it's too direct and impersonal. I want it to say "please add what you think". How can I do this?
Since menu links are structured now, this is very simple, however, this is a small caveat. In phpTemplate, the $links variable available in node.tpl.php has already been sent to theme('links'), as a result you have your links, but they aren't structured anymore!
In this case, what you need to do, is something like this in node.tpl.php:
bump
bump
I assume you are talking
I assume you are talking about the "Add new comment" link next to each node?
Also, you describe changing the comment text "depending on the page i am on", but when there are multiple nodes on a page (eg: front page), there will be links attached to each node. So, I'm assuming you mean that you want to change the text based on what node the link is attached to?
The current links are added to nodes by comment.module in comment_link() in a couple of places (once for the teaser view, and once for the full view). This module is creating a list of links, looking like this:
This adds a link, with a key of "comment_add", to the list of links that will be emitted for this node. All you need to do is replace this link with your own one. You can either do this at theming time as described in the previous comment, or if you write your own module, you just implement hook_link in your module, and add a new link with the same key - which will override the one already added by comment module. To do this, your module code would look something like this:
There is a trick however. Since module hooks are executed in order by their module weight, you need to make sure that your module weight number is bigger-than the comment module. You can either do this manually with the moduleweight module, or by using some SQL like:
HTH, Simon
In template.php
In template.php (Drupal5)
-steve.
------------------------------------------------
http://www.designbrigade.com
Ahh yeah, hook_link_alter is
Ahh yeah, hook_link_alter is a better way to do it. But overriding comment modules hook_link_alter is a wee bit naughty - if comment module implements that (as they have right to do) your theme will break.
Can the title be changed to an image
Is it possible in template.php to change ['comment_add']['title'] to an image? I tried to place the HTML IMG tag instead of text... all the was rendered was, indeed, just the text of my tag! Not really understanding the comment_link API documentation, I had a quick browse, but nothing really stood out.
Thanks
Robert
how can I take off only the
how can I take off only the add a comment link?
like $links['comment_add'] = '';
or
print $links['comment_edit']; //only the edit link