By bib_boy on
How would I change the url of the 'Add new comment' or 'Reply' to pick up a custom page template I created?
e.g.
http://www.example.com/comment/reply/1301#comment-form
change to:
http://www.example.com/custompagetemplate/comment/reply/1301#comment-form
what is happening at the moment is the add/reply to a comment page is defaulting to the normal page template and not my custom template...
maybe there's a better way of picking up a custom template for comments then mucking about with urls?
thanks
Comments
=-=
under comments
http://drupal.org/node/190815#template-suggestions
hook_link_alter?
thanks Vm, but is that not just for styling the comment bit itself. I want it to take on the page template based on a url (as it has differing header, sidebars etc)...?
i tried the hook_link_alter function in my template.php but no luck...?
the news/... url invokes my custom template for news node types.
and ideas?
=-=
hooks go into custom modules not in to template.php
template.php is for preprocess functions and theme overrides.
The issue at hand though is locating the reason why the theme isn't using teh correct tpl.php file for your comments. It should be using the active theme's comment.tpl.php file
I am not sure what you mean
I am not sure what you mean "It should be using the active theme's comment.tpl.php file"
so for example when I am in news/node/161 and I click 'Add new comment' the theme i have for page-news.tpl.php should be used for this comment page? Instead it defaults to the page.tpl.php...I would have thought this would happen but you suggest otherwise? I am lost....
BUT....
comment_link_alter works with template.php (instead of hook_link_alter)
but I have another issue in that I need the url with '#comment-form'...but this comes out in the url as '%23comment-form'
i.e.:
is news/comment/reply/161%23comment-form in the url...
I am nearly beaten now and users will just have to accept the changing pages templates when they add a comment...very frustrating.
some way forward...but I
some way forward...but I obviuosly have missed the point in all this
I used 'fragment'
so I can now get www.mysite.com/news/comment/reply/161#comment-form ...thinking it would bring in the page-news.tpl.php...which it did but no comment box...
1 step forward 2 steps back...
also having this issue
i am also having this issue and haven't been able to find anything about it. mysite.com/comment/reply doesn't really help because I'm using sections, so as of now, all the themes go to one theme for comment/reply/*/*.
anyone have any ideas?
thanks.
Anyone figure this out?
I'm having the same issue. On the site I'm working on, I have comments on two separate content types. Both of these content types rely heavily on views and have an alias. For example:
http://www.example.com/custom-content-a/node-title
http://www.example.com/custom-content-b/node-title
If the user adds a comment but it doesn't validate, they get redirected to http://www.example.com/comment/reply/nid
I need it to go to a specific path because certain block views show up depending on the path. I've tried redirecting the comment form to go to the path alias with a custom module, but that seems like the wrong thing to change.
Hint from comment.module
I know this is an old thread, but I came upon it and would like to share what worked for us. Our issue was that we were sending users to /user/login, then trying to redirect back to the node comment form. Unfortunately, our fragment 'comment-form' would get stripped, landing the user on the node page, but not on the comment form. Borrowing from comment.module, we rawurlencode the destination, and all works. Perhaps a hint for anyone trying to hack comments.