So I'm working with a interesting design which separates the comments in a separate region that the main content area that houses the article. I created a custom page.tpl file for the content type, and tried dropping

print render($content['comments']);

However, it didnt work. Any suggestions as to what I can do?

Edit: So just to be clear, I would require the comments to be available on a page level, but still stay related to the specific node being displayed on that page.

Comments

nevets’s picture

You can implement hook_page_alter(), something like this

function hook_page_alter(&$page) {
	if ( !empty($page['content']['system_main']['nodes']) ) {
		$nodes = element_get_visible_children($page['content']['system_main']['nodes']);
		$node_count = count($nodes);
		if ( $node_count == 1 ) {
			$nid = $nodes[0];
			$page['footer'] = $page['content']['system_main']['nodes'][$nid]['comments'];
			unset($page['content']['system_main']['nodes'][$nid]['comments']);
		}
	}
}

You can place this in your themes template.php file, remember to place 'hook' with your theme name.

Also, the example places the comments in the 'footer' region, change as needed.