By pielgrzym on
Hi peeps,
I've got a layout in which content of the CCK node is displayed in one column and comments are displayed in the other column parallelly to the content. That's the layout idea, but I can't achieve it. I made a custom node-content_my_article.tpl.php which prints only node title and node terms. But I still can post comments under the content. I didn't print $links but the damn comments (and 'comment or login' links too) keep appearing :((((
Anyone, pls help! :(((
Comments
Jesus...
Could someone at least tell me how to catch comments before they are glued to the end of content? It's far the dumbest idea to make the whole comments page be sticked to the end of content without the ability to print it wherever we want :(( aaargh. so frustrated :[
--
Pielgrzym
Patrially solved
Thanks to helpfull people from drupal-support irc channel we figoured out a way to move comments:
It's for Drupal 4.7.x:
Then we simply invoke our_comment() wherever we want in out theme :)
It actually catches the data passed to theme function and prints it out somewhere in the theme using an exact function copy. The only problem is the damn comment form. The comment form still appears under the node. I tried overriding mythem_comment_form the same way, but didn't succeed.
I beg for some help ;)
--
Pielgrzym
I'm trying to get this to
I'm trying to get this to work on 5.1 but it isn't working correctly...
Will post my solution once I get it.
didn't work for drupal 5
Looking in to how to solve this.
CSS
Maybe the easiest way is to try and use CSS and position:absolute etc to seperate the main node from the comments rather than php.
i dont believe this this
i dont believe this
this messes up my complete template design
i need to place the comments into a certain div
there is always a variable for everything like $titles $messages $missions etc.
WHY not for COMMENTS
Here ya go. Simplified.
Here ya go. Simplified. Scrap your previous code and place inside template.php.
After that, all you need to call is
theme('comment_wrapper'). Assign it to a variable or print directly from node.tpl.php or page.tpl.php. Haven't tested. It should do though.Good luck.
edit:: Oh, and this is for Drupal 5. Don't think there's a wrapper function in 4.7 but you get the idea. You should be able to make up a similar function.
comment form is now shown twice
thank you very much
the "redirect" of the comments works
but the comment form is now shown twice
once below the nodecontent and once below the redirected comments
but only the submit-button of the first form works
any idea how to fix this ?
Yeah, I see. It's do to how
Yeah, I see. It's do to how the comment form is called up and unfortunately it runs through theme_box() which is a very general theme function. I tried messing with it but there's no way to get the context reliably. An alternative would be to go through the comment administration page and set the comment form to output under the comments instead of on a separate page.
After that, you can simplify the function down to this:
I don't think anything else can be done about it from the theming end. If it bothers anyone, your free to create an issue. Search first though. :)
thanks a lot for your help i
thanks a lot for your help
i created as you suggested a issue http://drupal.org/node/161139 but didnt get any respond yet
the last days i tried to catch with an adapted version of your code the comment forms and place them were i want them to be
it actualy works fine but the forms and their previews are formated in a silly way
in my layout there are two areas
one for the page-view nodes with black background
and below a white one for the comments
the black area has a fixed size and contains text, images or videos and the white area contains their comments
i think its not realy a exotic way to display content
the following problem also appears when im not placing the comments and their forms somewere:
-in the page view of a node - the node and its comments are at the right places
-when i reply a note - they are also at their right places
-when i preview a node reply - the note content is now below the comment area
(the node is getting appended to the form in comment.module, function comment_form_add_preview() line:1623 with (
)
i can remove this with hook_form_alter()
-when i reply a comment - the node content is gone and at its place the parent comment is shown
-when i preview a comment reply - the node-content is gone and the parent comment is shown below the comment form
-when i preview a comment edit - the node-content is gone
i can get the nodes back in page.tpl.php with:
but there are still some comment previews flying around in my theme
i realy dont get the point of gluing nodes and comments in this not flexible and nonuniform way together
of course i also tried around with the comment settings "Display on separate page" and "Display below post or comments"
if somebody nows if there is another way to customize comment-forms than changing the core comments.module
please tell me
Doesn't work for me?
I tried using these comment snippets (in this post above: http://drupal.org/node/122240#comment-252946 ) on my site, but with no results.
I followed the instructions above: I pasted those two snippets into my template.php and called the "theme('comment_wrapper')" inside my custom tpl.php file for the nodes which comments I'd like to theme/move around.
I checked out that $output is returned, but it's returned empty. If I add something to the $output it gets returned - so at least the right function is called from my node's tpl.php.
I must be missing something here? As obvious as that "something" might be, would you mind pointing it out? I've been stuck with this for quite a while now..
Thanks!
Informative Article
I use drupal it is really great . Its features are mind blowing. It is very good for new comers. Your programs are really helpful. And this article is very knowledgeable. Your working style and new release are really mind blowing.
Football Kits
Jquery workaround
Solution is not the cleanest, but it works well and is easy to implement. I have Drupal put the comments at the bottom of the node, then use jquery to move the comment div :
HOW TO move the comment form to your liking...
Hi,
I ended up paying someone for a solution to this problem. Here is the best way around this problem, to date. The solution has been tested on Drupal 5.1. Unfortunately it requires you to hack the core - just be sure to make a note to modify this again when you do an update to drupal core.
If you want to move the comment form to your liking, you need to call it (the comment form and comments) in the node-nodetype.tpl file... Here we go.
Open up node.module file and look for:
And modify that too:
Then, you go to your node.tpl theme file and add this snippet where you want to call the comment form and comments:
If you have several node types, and you want to only move the comment form and comments on let's say, node type blog, you would do this instead.
Then in the node-blog.tpl file, we add the same snippet as above:
Please reference this post on other posts where you have read about this problem, so the drupal community will find this solution easier...
Happy comment form and comments moving!
Thanks!
Thanks for that!
I generally try never to touch core, but when it seems we've tried every possible alternative it looks like the only option.
Thanks for the help :)
It is my pleasure. We should
It is my pleasure. We should ask the drupal 6 team to consider a solution for the comment form and comments, so we won't have to hack the core the next drupal version.
No need to hack core
Thanks to litwol on IRC for thinking of clearing out $node->comment.
Put this where you want it in your node-TYPE.tpl.php:
Michelle
--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.
hey really i love u for this solution!!!!!!!!!!!
really i am soooooo happy now after doing my job
really thx for u and may god bless u
regards
mohd nashaat
Drupal 6 has same problem
I'm still seeing exactly the same problem in Drupal 6. The code that spits out the comment form is embedded in the node.module rather than being left to the theme designer. I don't want my comments within my node's node.tpl.php, I want them displayed elsewhere in my template's page.tpl.php. Is there no solution for this?
I've tried using litwol and Michelle's code above which will only work if the comments are set to display below the post and even then will display it twice as the node is still rendering the comments as well. If only they had made the very simple function node_show themable in node.module. That way we could choose to override the display of contents and add them in the template where we want.
I've submitted a feature request in the Drupal 6 queue, lets see if there are any takers... otherwise its hacking the node.module time.
For Drupal 6, you can try
For Drupal 6, you can try this in template.php:
I loved the referenced variables. :) It makes this possible.
You must clear the theme registry for this to work.
Now you'll have $comments and $comment_form inside page.tpl.php which will output only when your focused on a node. Make sure you set the reply form to separate page first. It will break the form's js behaviors. It could be a simple fix.
Oh, and forget about the feature request for 6. It's too late. Would be nice to make it straight forward for 7.
⎋ joon park
Nice one dvessel, this is a
Nice one dvessel, this is a good solution for Drupal 6.
Smart solution and it uses the Drupal way
It works like a charm and it's a good use of preprocess functions, thanks for the tip.
Alexis Bellido
Ventanazul: web development and Internet business consulting shouldn't be boring
Using Node Comment Mode After
If you need to use the node's comment mode in your theme, use :
node_comment_mode($node->nid)instead of
$node->commentThis works perfectly but how
This works perfectly but how do you fix the broken form javascripts? (they are no longer included on page load).
It worked like a charm in
It worked like a charm in 6.19!
To display the comments+comment form, I just added the line below anywhere in your page-mypage.tpl.php:
<?php print comment_render($node, $node->cid);?>I used this feature to put a block just after the content of my page and just below it is the comments and the comment form.
Thank you very much dvessel for your solution!
For Drupal 7
For Drupal 7, check out http://www.midwesternmac.com/blogs/jeff-geerling/moving-comments-block-d... - similar kind of implementation, but putting things into a custom block will allow you to simply drop the block in any region, and it will be rendered wherever you want on a page.
__________________
Personal site: www.jeffgeerling.com
I had to hack core
This didn't work for me - the comments & submission form replicated instead of just moving. But the core hack worked like a charm. Thanks!
Is there a way to remove the
Is there a way to remove the comment addition form from this?
This method doesn't work on php4
Note, this method, while elegant on php > 4, fails completely on php <= 4, due to the fact that objects are not passed by reference in php <= 4.
Views pager is gone..
While this solution did what it's supposed to, it also made the Pager for the view (inside which the nodetype in question is displayed) dissapear!
Can you guys think of any workaround for that problem: dissapearing pager?
And I can say.. I spent hours on figuring out where did my pager go..
-jamov
But the comment form ... ?
Thank you, Michelle, for this great hint. It really works well and allows me to put all the comments into a block.
But I am afraid only the existing comments are rendered in the block. But the comment form is still remaining at the end of the node.
How can I achieve to get it into the block too?
I have the same problem. I
I have the same problem. I don't know how to remove comment form and leave only comments.
I found (dirty) solution how
I found (dirty) solution how to hide comments form when we add this code above.
In my case I can do this only via css.
Unfortunately the form code is still in source of our page but it don't appear for visitor.
Few minutes ago I saw Panles 2 screencast (http://blip.tv/file/600413) and I think maybe this way we can also do that but I didn't try this yet.
Does this really work?
Well I didn't try your solution yet, but I imagine that by hiding the comment form by css it'll be gone at all. How can I get it shown up in another place?
Panels2 might be a good solution to get the form into another column. But I am afraid it'll not work in my case because I want the form to show up in a block.
this worked great for 6.12
that was awesome. I was able to put this inside my jquery tabs. works perfectly. thanks
What about error in comment form
It seems that this hack
as a limitation, when you send an empty comment or wrong captcha, page /comment/reply/200 apparears with the comment form outside the node again.
Phil
subscribe
subscribe
Possible solution in D6
I seem to have a working solution in Drupal 6. This isn't totally tested yet, but so far it is working nicely and i have a lot of faith in it.
To do it, open up your template.php and adapt the following to yours:
This should make a
$commentsvariable available to the page.tpl.php. Using the_phptemplate_variables()function, you should be able to do much the same in D5. This is just the first step I am sure, and I plan to play with it more over the weekend.--
Al "Zarabadoo" Steffen
--
Al "Zarabadoo" Steffen
You're making the same thing
You're making the same thing that another user has done some comments above…
See: http://drupal.org/node/122240#comment-707961
duplicate comments
The comments are rendered where I put the $comment variable in page.tpl.php but they are also appearing as part of the $content variable.
Am I correct in assuming that the code below should take care of that? (It's not on my site, even after clearing the cache.)
By unsetting the node variable, is the idea that the engine will not append comments to the node when creating the $content variable for page.tpl.php?
in reference to the node hack
My question specifically is if the code for D6 is supposed to replace the node.module hack described by pielgrzym or if you still need that hack. (I resorted to using the hack for now.)
is there a similar function
is there a similar function to separate all the $links in the out of box $links variable, like the read more etc
why is all this done for
why is all this done for page, why not node
after all it is the node.tpl that calls the link function where it is part of the array?
I declared a region
Declare a region inside node.tpl.php like described here
http://drupal.org/node/361209
<?php print $content_bottom; ?>should go somewhere after $contentAfter that you have the whole region to put things in between of content and comments
that's for the post guys!...but how do I...
how do I remove the existing comment now? I can move the comments to were ever I want but the existed comment is still under the node. How do I get rid of that?
Thanks, - Justin
Same question here - In
Same question here - In Drupal 5, how do you move the comment form?
Moving Comment Form
mcneelycorp's post from 9/19/07 (http://drupal.org/node/122240#comment-272809) is clearly described and works as advertised in Drupal 5.7
The problem is their
The problem is their solution requires you to modify the core, which I thought is a no no in the world of drupal?
It is a no no. But in my
It is a no no. But in my case, no one had an answer and cared to create a solution. It seems now there is another option but others are reporting problems with the newest snippet. Back to square one...
===
Elvis McNeely
Drupal services: http://www.elvisblogs.org/drupal
i totally agree at this
i totally agree at this point to hack the core (and i normally say no,no,no) in case of doubt - all this workarounds in such a substantial thing ... sometimes we "themers" can't spend days trying solutions, that are not 100% perfect at the end ... in 7 it's a must to have variables seperated from $content including seperate stuff for the form.
thanks a lot for all posted answers here ...
greetings momper
I am on a no no side. Once I
I am on a no no side. Once I hacked the core, headaches strike:)
love, light n laughter
gausarts
love, light n laughter
Method to output anywhere on node.tpl.php (Drupal 6)
got that all wrong. sorry!
Comment Display module
The Comment Display module does (in Drupal 6.x) what this thread tries to do. It prevents comments from displaying at the end of a node (i.e., at the end of $content) and creates a new variable called $comments, which you can place anywhere in page.tpl.php. (I'm not sure about node.tpl.php.)
works not in the
works not in the node-template. Just in the page template, what is quite disappointing.
Would be useful...
... to have these variables in node.tpl.php.
Been scrambling around this for ages!
If i can put a comment form through node.tpl.php, can't seem to preview the comment. If i do so, it takes me to comment/reply and throws a page not found error.
This is the code that i used:
Any simple way to put this working?
Thanks in advance
Got it.
For Drupal 6
Just use this code in any .tpl.php.
Just make sure that you have $node set.
Thanks a lot
I was looking for a solution to use in node.tpl.php
This one works
Thanks a lot
Can this work for single node templates?
Hi all,
Can anyone please tell me if the code posted earlier can be modified so that it only affects a specific node.tpl.php
My problem is that all comments have disappeared from other content types where I need the Comments to be displayed as normal :(
The code I'm using in my template.php is...
I've tried to add an 'if' statement in the second function but it doesn't appear to work correctly as it will render the comments normally in other content types and twice in the modified node.tpl.php
I know the code is probably way off but I tried...
My node template is node-design_submissions and uses the following to render the comments and the form seperatley:
and
Any help would be greatly appreciated :)
OK, managed to answer my own question
Sorry about this but thought I'd post my findings just in case anyone else is looking.
To comments around on specific node.tpl.php files the function in template.php needs to be;
...replacing content_type with your own content type value.
Cheers
multiple submissions
I've tried this and it does position the comments where I want them but every time I try to submit a comment It submits multiple times, almost like it is stuck in a loop of submitting.
Is anyone else having this problem? Any ideas why this would happen?
a solution...
Ok after a lot of trial and error I have found what seems to be a workable solution.
What I've been trying to do is get rid of the standard placement of the comments and manually position them inside my node.tpl.php
The problems kept arising that either I was getting no comments, no form, or 2 of everything.
Eventually following the suggestions above I got it the way I wanted but it resulted in multiple submissions for each posted comment (I'd be interested to hear if others have this problem)
Finally I went back to square one and tried to keep everything simple and here is the solution I found which seems to work now:
In the template.php add:
function phptemplate_preprocess_node($vars) {
$vars['comments'] = '';
if (function_exists('comment_render') && !empty($vars['node']) && $vars['node']->comment) {
$arg2 = arg(2);
$vars['commentshow'] .= comment_render($vars['node'], ($arg2 && is_numeric($arg2) ? $arg2 : NULL));
}
unset($vars['node']->comment);
}
and then in the node.tpl.php add when you what your comments rendered:
print $commentshow;
hope this helps
many thanks
Hi slicedsoup,
many thanks for the solution!
I think the slicedsoup
I think the slicedsoup solution is the best :)
The above works good but how
The above works good but how would I go about listing the comments in a QuickTab using a block? If I insert this into the block
Then comments don't show as I think I need something to let the block know what page its on?
Inserting comments into block
I found the solution how to insert comments into a block on this site: http://www.rubberneckdesigns.com/drupal-6-drupal-7/drupal-comments-in-a-...
Create the block and use php filter with this code:
Then you can select this block in Quick tabs.
Tested on D6.
How i can hide the comment form?
Hi, i use the solution in http://drupal.org/node/122240#comment-707961 to move the form comment, but the form still shows the original site also.
I want to hide the original form and shown only that i want.
How i can hide the form??
Thanks
-----------
Solved!
Can you post the solution
Can you post the solution please?
I'm having the same problem.
Thanks
This works for me on
This works for me on D6
http://drupal.org/node/122240#comment-1740582
Hi, I would like to do the
Hi, I would like to do the same thing in Drupal 7. Any ideas? I would like to have a blog like entries down the left side and then on the right side the comments for all those entries. Any thoughts?
I m fan of Panels module it
I m fan of Panels module it gives you opportunity to add comments block anywhere even other things as well. But if you want to add through code here is link for it:
D6: http://api.drupal.org/api/drupal/modules--comment--comment.module/functi...
D7: http://api.drupal.org/api/drupal/modules--comment--comment.module/functi...
Thanks
regards
Dev/Kuldev
Thanks for the info, also
Thanks for the info, also does Panels provide ways to show Comments form?
Comments Block module for Drupal 7
I'm surprised nobody has mentioned this yet. Worked well for me. http://drupal.org/project/commentsblock
FYI
Regarding the module commentsblock, this (7.x-2.0-beta1) is currently broken and does not work with Drupal 7.19 to show the comment form.
D6
I also needed to do this with Drupal 6, so I enhanced comment_bonus_api for this purpose.
In a nutshell, since the module already takes over node_show we have flexibility to do whatever we want with that function. I added an admin UI with a variable for each node type. You can now selectively enable/disable comment rendering on a per node type basis. This is generally in line with this idea: http://drupal.org/node/122240#comment-272809 but no core hacking is required.
Issue: #1555270: Selectively enable/disable comment rendering by node type
It's currently going to be in the -dev branch, so either use that or wait for 6.x-1.1 module release.
Note that if you use this approach you need to use comment_bonus_api_comment_render() to output your comments, not comment_render().
Here's what I dropped into my node-mynodetype-full.tpl.php:
--
Like us, follow us, or visit us!