I have just started using drupal and am little bit confused with the flow. I have a variable $var = "<div>Render in View</div>"
in a function in my .module file. How do I render this exact html in the page.tpl.php file?
Thanks
I have just started using drupal and am little bit confused with the flow. I have a variable $var = "<div>Render in View</div>"
in a function in my .module file. How do I render this exact html in the page.tpl.php file?
Thanks
This might work: http://api.drupal.org/api/drupal/modules%21system%21theme.api.php/function/hook_preprocess/7
function mymodule_preprocess(&$variables, $hook) {
if ($hook == 'page') {
$variables['my_custom_page_var'] = '<div>Render in page.tpl.php</div>';
}
}
or use the dynamic hook name
function mymodule_preprocess_page(&$variables) {
$variables['my_custom_page_var'] = '<div>Render in page.tpl.php</div>';
}
Then this should be accessible in page.tpl.php as $my_custom_page_var
.