Hello there,
So, I'm having an "i'm not a developer" momment that I hope someone with a bit of expertise can just solve in a minute.
I took out the links snippet from my node.tpl.php file:
<?php if ($links): ?>
<div class="links"><?php print $links; ?></div>
<?php endif; ?>
Since this also deletes the "add comment" link, I would like to just add a link that reads "Add Comment". I don't even want it to show the count of comments, since that is shown in other place in the template. I have tried a couple of codes that I found searching in Google, but they didn't help.
Being sincere, if I can get the add commment form to be shown by default in the full node view I'm more than fine with that. But I haven't been able to do that either.
Is it really hard? Can anyone give some hint on how to achieve this probably prett easy stuff?
Thanks a lot!
Comments
subscribing...
subscribing...
Warm regards from sunny México!
Pepe
:-)
In the node.tpl.php, or in a
In the node.tpl.php, or in a php-enabled block in your content, try this code:
Just like views arguments works with pathauto, the "numeric" arg(1) should too. Let me know if I'm wrong on that :)
Alan
Sounds perfect
Thanks alan.pinkert!
It looks like you just hit the jackpot! I'm going to try and will let you now.
Not working :(
I just added the code, but it is not working :(
When I click on the link "add comment", it gets me to this URL: mydrupalsite.com/node/comment/reply/1536#comment-form
The problem is Drupal tells me that page doesn't exists.... so I don't know what to do!
By the way, I noticed you didn't close the "endif". I added the closing, and then I get this message from the server (not from drupal):
Parse error: syntax error, unexpected T_ENDIF in /home7/rojastwo/public_html/apuntesdepublicidad/sites/all/themes/apuntes/node.tpl.php on line 32
If placing the code in
If placing the code in node.tpl.php you can simply use
which insures the path is relative to your sites root.
SWEET!!!
This solution works perfectly! Thanks a lot nevets!
And thanks alan.pinkert too for all your help ;)
Cheers!
Hi, nevets
Hi,
I have used above code to create "Add comment" link for node.tpl.php here that links appear on this page http://11.caarcher.biz/content/happen but when i click on "Add Comment" it shows me this message in red
"This discussion is closed: you can't post new comments." I am not getting why it happens? Any help.
Thank you,
Rahul Barge
That implies you have
That implies you have comments disable for the node (and possibly the content type).
Thanks for your reply
Thanks for your reply, but i have check comments are enable for the node. (and for that content type)
Thank you,
Rahul Barge
Whoops, you're right
Silly me, about the endif problem: try grouping all the PHP together in one php statement, instead of split up.
The URL that you have is already relative to the site. My guess is you just have a different path to your node. You can use the fix above, or, if you know what that path is, another way is to just write it out, as in mydrupalsite.com/your-path-to-the-node/comment/reply/$nodeid#comment-form.
Alan
mmm
I understand what you are saying, and makes sense since I have some aliases... but the comment form should use the standard Drupal URL and not the alias, right? And if I add my URL (mydrupalsite.com/node-type/taxnonomy/whatever-else/comment/reply/$nodeid#comment-form) I guess I have to edit the node.tpl.php file for each node (node-type1.tpl.php, node-type2.tpl.php, etc.), wich makes me work more, hahaha ;)
I'm going to try the other solution and see the results ;)
If you care about permissions
If you care about permissions in node.tpl.php you could use
Thanks
Thank you nevets, but if I use the "links" function I will also get the number of comments and the "read more" link 8wich is something I don't really mind having or not)... right?
Correct, you might want to
Correct, you might want to look at comment_link() then (its in modules/comment.module) to see how it handles permissions.
Thank you
I been having trouble with this for two weeks... driving me nuts.
Thank u