views:

93

answers:

3

I'm developing a theme for a Drupal blog; the mock-up I created requires the post content, trackbacks block and comments block to appear in a central column, with borders running either side.

I've got the CSS and HTML working correctly, so that's not the issue here. My problem is that the comments block as generated by Drupal is placed outside of the div defining the central column, and so it appears out-of-place. As such, I think the solution is to stick a line into my theme saying "print column block here", but having scoured the Drupal docs I can't see any way to do so. Based on the HTML output by Drupal, I'm not sure a CSS/HTML fix is going to work.

I'm sure other Drupal theme developers must have come up against this before...

+1  A: 

There are several ways to address this in Drupal 6.

Using something like the comment_display module, you can manually place the comments anywhere in your page.tpl.php file.

Alternatively, you can do something similar using panels.

jhedstrom
There's no way to do it with just Drupal core? It strikes me that the trackbacks are going to be similarly problematic, and they're supplied by a third-party module. Is there some wrapper variable that covers everything displayed after the post itself?
alastairs
Not in Drupal 6, due to the fact that the node_show function directly calls comment_render. What the comment_display module does is first trick node_show into thinking comments are disabled, and then via preprocess_page, it renders the comments into a variable that can be placed in page.tpl.php. If you look at the code, you may find that you can do something similar in a custom module or theme that better suites your needs.
jhedstrom
+2  A: 

In the node.tpl.php you can create the html for the node's full display (the node is being viewed). You can create templates for each node type, fx node-blog.tpl.php etc. The default node template just prints $content, but if you want, to can instead print the each item separately with the desired markup.

This is less dynamic, as you would need to add new items if they were added to the node, but it does give you more fine grained control over the markup. This is the most simple solution I can think of.

To place the comments use this snippet:

<?php print comment_render($node); ?>

or lookup the comment_render() function

googletorp
+1  A: 

I eventually managed to resolve this using an HTML and CSS fix after all. It's not as seamless as I'd like, but it's not the end of the world.

Thanks for the suggestions, I hadn't anticipated that things like comments would be output as part of the node content!

alastairs