2

The front page of my site needs a very different layout to every other page on the site, so I want to use page--front.tpl. However, the front page still has many of the standard regions, and shares the same main_menu as the rest of the site.

I have just tried moving the shared "outer" parts of my page.tpl (including main_menu and page_bottom) into the html.tpl because I want to use page--front.tpl without duplicating code if possible.

Unfortunately, many of these variables, notably main_menu are defined only for page.tpl, so I've had to hack it into X_preprocess_html. This makes me nervous because I don't know what other variables I might be missing: I basically want to refactor it to avoid code duplication.

Am I going about this the wrong way? Or if not, how can I be sure I still have all the variables and regions I need pushed up to html.tpl?

0

Yep, you can do it in a simple manner, just follow this

It simply states you can (for example) use <?php include 'page.header.inc'; ?> on a template and include the code for that header. In this .inc file you just enter the code you want to reuse

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.