I've been trying to manipulate the content of the header variable using template.php, but have not been able to do this.

The header variable seems to appear in page.tpl.php as $page['header'].

Can anyone tell me how I access this in function _preprocess_page?

In D6 I used the following:

function _preprocess_page(&$vars) {
$vars["header"] .= t('

My theme heading

');
}

Many thanks for any help anyone can offer on this - I've spent many hours trying to work it out!

Alan

Comments

Anonymous’s picture

Priority: Normal » Minor

After a few hours trying to figure out how to manipulate the variables in the new structures that D7 has introduced, I've now got to where I need to be by changing the page template as outlined at http://adaptivethemes.com/documentation/using-template-overrides

I'd always worked on the basis that changing the templates was a bad idea, but the documentation for Adaptive suggests that this is the correct way to go.

If anyone can advise on how to access variables - including those that look to be in nested arrays - in preprocessor functions in template.php that would be very helpful as I suspect I'm going to need to do this at some point.

Thanks,

Alan

Jeff Burnz’s picture

Component: Subtheme » CSS/HTML
Status: Active » Closed (fixed)

In Drupal 7 the most powerful, and I would argue the correct way, to do this sort of thing is using hook_page_alter().