- Template file to display a page's output in Drupal
- This file contains a combination of php and html tags
- To render the content, we need to use the PHP variables. For list of available variables, see handbook page
- Simply called as a preprocess function, defined in template.php of active theme
- Essentially used to add/alter variables before they are rendered in the template file
- To use, replace "hook" with module or theme name and "HOOK" with 'page','html' or 'block' as needed
- In your case, this will be "my_theme_preprocess_page" since page template should be altered
Creating separate page.tpl.php:
Let come to the heart of the topic, by reading the above explanations you would have obtained a pinch of salt about the real scope in using page.tpl.php and hook_preprocess_HOOK.
Now do the following:
In active theme's template.php file add the below hook_preprocess_page() implementation,
page--node--page.tpl.php, etc. will be our per node tpl.php page.
Of course to be created by forking page.tpl.php, this will help you to have different page structure based on the content type.
Nice and useful, thanks.
page--node--article.tpl.php, page--node--page.tpl.php, ... OR