Hi

I've just come across a Drupal site where there are 100s of lines of custom code in the page template file. I have a sense that this is not the Drupal way, but I am not sure why. I wonder if someone could articulate it for me, or point me at some relevant documentation.

Thanks

Comments

Kuldip Gohil’s picture

You can put your code into template.php file inside your theme.

You can use preprocess functions to override variables or create new variables for your page.tpl.php

Thank You,
Kuldip Gohil

bignosestrikesagain’s picture

Thanks Kuldip. I guess my question is more why should I try to keep code out of the page template file itself ?

Kuldip Gohil’s picture

http://drupal.org/node/11812 page.tpl.php files is skeleton of drupal page, so we should use only put html code and use defined variables.