Hello,
is there an easy way to have content shown between the node and its comments? As the Comment Module doesn't provide a block for the comments, it can't be done by rearranging blocks.
What I tried:
- changing comment.tpl.php
I tried to put the content of the region in front of the comments by adding it in the comment.tpl.php above the comment code, but that didnt produce any output. Seems as the region variables (for example $content_bottom) arent available in this template.
- node.tpl
Unfortunately the whole node content including comments is in $content, so there no way to put something in between.
So, is there a comfortable way to do what I want? An uncomfortable way would be to set the content via hook_nodeapi()....
Best regards
Philipp
Comments
I think this can be done,
I think this can be done, but it will be trisky ;).
Give this a shot:
In comment.tpl.php, put everything (including HTML) into a global variable:
And, don't print/echo/output anything in this file.
Then just make a new block with the following content (PHP Input enabled):
And... you can make other blocks that go above this one.
Let us know how it goes.
---
Yuriy Babenko
www.yubastudios.com
My Drupal tutorials: http://yubastudios.com/blog/tag/tutorials
---
Yuriy Babenko | Technical Consultant & Senior Developer
http://yuriybabenko.com
Hello Yuriy, this works,
Hello Yuriy,
this works, thanks! Unfortunately, it only puts the comments itself in a block, not the comment form. Is there a way to place the comment form in a block, too?
Best regards
Philipp
What if the comment.tpl.php
What if the comment.tpl.php is complex with php conditions and such?
Can all of this still go in the $comments_data string?
---
Like what you see? Leave a tip!
spiffy[d] | simplicity is bliss
You can assign a region to
You can assign a region to node.tpl.php in Drupal 5, which will allow to you print content between the node content and the comments (comment form prints below node content or comments as per normal).
You need a couple of things - a new region & set a variable in phptemplate_variables in template.php and finally print the region in node.tpl.php.
As an exercise I did this for Bluemarine in Drupal 5.
template.php - create a new region and make it available in node.tpl.php
node.tpl.php
Now you can print whatever you want there in block etc etc.
Another way (yes, there is another way!) - if the content you want to print is a View, just print the view directly in the node template, e.g if your view is a block view...
Hope that helps some, good luck!
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
Thanks that realy helped!
Thanks that realy helped!
how to do this in drupal 6 ?
how to do this in drupal 6 ?
I second this... help for
I second this... help for Drupal 6 would be appreciated!
see this post
see this post http://drupal.org/node/361209
@mean0dspot... that post did
@mean0dspot... that post did not help.
My blocks in the "content" region still display below the "Post New Comments" block even with that snippet of preprocessing code.
yes, and they will. what you
yes, and they will. what you should do is creating ADDITIONAL region, named in the example "content_bottom" and assign blocks to it, NOT to "content" region
it takes 3 code edits:info file, node.tpl.php file AND preprocessing function
New created region has no
New created region has no problem shows above "Post New Comments" string. You just need to add the region code to the right place (right after content section ) of your node.tpl.php file. See result and a step by step on my post :
http://www.o-learn.com/content/drupal-6-how-to-create-a-new-block-region...
As an FYI...And I too am
As an FYI...And I too am trying to figure this out, and create a module with my custom functions. So far, just to let you all know, in response to what pmg's said:
I my hours of digging I found that comments are NOT part of a nodes $content, and it takes a ton of functions to show a single node. Refer to the API node_show. And note that node_show is not the last function before a full node is shown, it is called by another function.
Creating a region is a good idea, or modifying the the node template. If it is at possible through a custom module to have content render between node and comments would be great too, without the user having to modify their node template, but I haven't found the solution to that yet without hacking core. What best to do probably depends on "what" a person is trying acheive.
...
If you are using Drupal 6 this becomes a whole lot easier.
Pimp your Drupal 8 Toolbar - make it badass.
Adaptivetheme - theming system for people who don't code.
You saved my day!
I googled around to search this problem and found below URL
http://www.innovatingtomorrow.net/2007/12/11/how-embed-region-node
But you know what, it missed the last step i.e. print the blocks in node.tpl.php file :)
Thank a lot for complete steps.. You could see it working here Java Examples now.
Regards,
Rahim.
D7
how about D7?
please explain..