I am new developing my first ever site in drupal. Along the line, due to the requirements of the project I had to create custom node pages (template files) instead of the default ones in drupal. For example my site has content type ‘Article’ and the template file for that is page–node–article.tpl.php. In page preprocess, I switch to the right page template with this code
if (isset($variables['node']->type) && !empty($variables['node']->type)) { $variables['theme_hook_suggestions'][] = 'page__node__' . $variables['node']->type; }
Now, my problem is how to display comments and comments form. The drupal print render($content[‘comments’]); is not working. I have installed Devel and I can see the comments and comments_form variables in the back end under the Render tab but I do not know how to access and display comments on the front end either by using these variables or another means.
Please help.
EDIT After digging into variables available on the page I was able to get the form to show using
print render($page['content']['system_main']['nodes'][$node->nid]['comments'])
but when I try to submit a comment an alert comes up saying OK and the comments cannot be found when i check in the back end to approve. Any thoughts pls
Sponsored by SupremePR