Posted by tahiche on August 10, 2011 at 6:13pm
Hi:
It´s my first experience with OpenPublish and I´m finding it very interesting.
There´s something that´s driving me crazy, though.
$page_header (and footer...) is set to the content of "page-header.tpl.php", but how?. The only place that looks like it might be hapennig is "OpenPublish Core module file".
/**
* Implementation of hook_theme()
*/
function openpublish_core_theme() {
print "<h1>openpubppppppppplish_core_theme</h1>";
return array(
'op_related_terms' => array(
'arguments' => array('taxonomy' => NULL),
'template' => 'op-related-terms',
),
'op_addthis_widget' => array(
'arguments' => array('addthis_link_title' => NULL),
'template' => 'op-addthis-widget',
),
'op_breadcrumb' => array(
'arguments' => array('breadcrumb' => NULL),
'template' => 'op-breadcrumb',
),
'op_homepage_tweets' => array(
'arguments' => array('tweets' => NULL, 'twitkey' => NULL, 'title' => NULL),
'template' => 'op-homepage-tweets'
),
'page_header' => array(
'arguments' => array('page_vars' => NULL),
'template' => 'page-header'
),
'page_footer' => array(
'arguments' => array('page_vars' => NULL),
'template' => 'page-footer'
),
);
}But any change made here is not reflected (cleared caché and tested that it was rebuilt).
How does the theme take the content of the file and assigns it to the var?. Also, other vars set here like "op_related_terms" are not available to trhe page.
It looks like a great way to work, assigning vars to tpl files just like you do with template files for content types, but I just can´t see how it´s being done.
Please help!!
Thanks in advance.
Comments
You need to read a bit about
You need to read a bit about Drupal to understand how this works. This is standard Drupal. If you really want to understand then you should read de Drupal Theming Guide (http://drupal.org/theme-guide/6-7).
The quick answer is in two functions of sites/all/modules/openpublish_core/openpublish_core.module: the one you mention openpublish_core_theme() and openpublish_core_final_preprocess_page(). In the latter function the code:
$vars['page_header'] = theme('page_header', $pagevars);$vars['page_footer'] = theme('page_footer', $pagevars);
basically generates the HTML using the page_header template which is defined in the first function: openpublish_core_theme() and sticks it into the page_header var.
Cesar Miquel
http://www.easytech.com.ar