function phptemplate_page in Drupal 4
Same name and namespace in other branches
- 5 themes/engines/phptemplate/phptemplate.engine \phptemplate_page()
Prepare the values passed to the theme_page function to be passed into a pluggable template engine.
File
- themes/
engines/ phptemplate/ phptemplate.engine, line 139 - Handles integration of templates written in pure php with the Drupal theme system.
Code
function phptemplate_page($content) {
/* Set title and breadcrumb to declared values */
if (drupal_is_front_page()) {
$mission = filter_xss_admin(theme_get_setting('mission'));
}
/* Add favicon */
if (theme_get_setting('toggle_favicon') && ($favicon_url = check_url(theme_get_setting('favicon')))) {
drupal_set_html_head('<link rel="shortcut icon" href="' . $favicon_url . '" type="image/x-icon" />');
}
/**
* Populate sidebars.
*/
$layout = 'none';
global $sidebar_indicator;
/**
* Sidebar_indicator tells the block counting code to count sidebars separately.
*/
$sidebar_indicator = 'left';
$sidebar_left = theme('blocks', 'left');
if ($sidebar_left != '') {
$layout = 'left';
}
$sidebar_indicator = 'right';
$sidebar_right = theme('blocks', 'right');
if ($sidebar_right != '') {
$layout = $layout == 'left' ? 'both' : 'right';
}
$sidebar_indicator = NULL;
// Construct page title
if (drupal_get_title()) {
$head_title = array(
strip_tags(drupal_get_title()),
variable_get('site_name', 'drupal'),
);
}
else {
$head_title = array(
variable_get('site_name', 'drupal'),
);
if (variable_get('site_slogan', '')) {
$head_title[] = variable_get('site_slogan', '');
}
}
$variables = array(
'base_path' => base_path(),
'breadcrumb' => theme('breadcrumb', drupal_get_breadcrumb()),
'closure' => theme('closure'),
'content' => '<!-- begin content -->' . $content . '<!-- end content -->',
'footer_message' => filter_xss_admin(variable_get('site_footer', FALSE)) . "\n" . theme('blocks', 'footer'),
'head' => drupal_get_html_head(),
'head_title' => implode(' | ', $head_title),
'help' => theme('help'),
'language' => $GLOBALS['locale'],
'layout' => $layout,
'logo' => theme_get_setting('logo'),
'messages' => theme('status_messages'),
'mission' => isset($mission) ? $mission : '',
'primary_links' => menu_primary_links(),
'search_box' => theme_get_setting('toggle_search') ? search_box() : '',
'secondary_links' => menu_secondary_links(),
'sidebar_left' => $sidebar_left,
'sidebar_right' => $sidebar_right,
'site_name' => theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : '',
'site_slogan' => theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : '',
'styles' => theme_get_styles(),
'tabs' => theme('menu_local_tasks'),
'title' => drupal_get_title(),
);
if (arg(0) == 'node' && is_numeric(arg(1))) {
$variables['node'] = node_load(arg(1));
}
return _phptemplate_callback('page', $variables);
}