I want to use the $comment object in page.tpl.php.
Is there a function or a way to use it?
| ||||
|
feedback
|
|
The page.tpl.php template file is used for any page output from Drupal; it is not said the page is being output for a node. It would be rather better to use node.tpl.php, which is always used for a node, except when a different template is being suggested and that file exists. The code I am reporting is valid for page.tpl.php, but with few changes it can be used also for node.tpl.php.
In the case the code is used in node.tpl.php, it is not necessary to verify if As pointed out from Jeremy French, such code should never go inside a template file, which should just contain presentation code (i.e. code that prints out the content of variables). That code could be the body of a function (contained in template.php of a theme) that builds up the output shown from the template file; alternatively, similar code should be used in a preprocess function. In this case, the code is similar to the following one.
page.tpl.php should then print the content of
To notice also that Drupal uses comment.tpl.php, to which is passed a comment object. Depending on what you are trying to do, that could be the template file you are really interested in. | |||||||||
feedback
|