xtemplate_page

File

themes/engines/xtemplate/xtemplate.engine, line 114
Handles the interface between XTemplate files and the Drupal theme system.

Code

function xtemplate_page($content) {
  global $xtemplate;

  // 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', '');
    }
  }

  $xtemplate->template->assign(array(
    "language" => $GLOBALS['locale'], 
    "head_title" => implode(' | ', $head_title), 
    "head" => drupal_get_html_head(), 
    "styles" => theme_get_styles(), 
    "onload_attributes" => theme_onload_attribute(), 
    "primary_links" => theme_get_setting('primary_links'), 
    "secondary_links" => theme_get_setting('secondary_links'),
  ));

  if ($logo = theme_get_setting('logo')) {
    $xtemplate->template->assign('logo', $logo);
    $xtemplate->template->parse('header.logo');
  }

  if (theme_get_setting('toggle_name')) {
    $xtemplate->template->assign('site_name', variable_get('site_name', ''));
    $xtemplate->template->parse('header.site_name');
  }

  if (theme_get_setting('toggle_slogan')) {
    $xtemplate->template->assign('site_slogan', variable_get('site_slogan', ''));
    $xtemplate->template->parse('header.site_slogan');
  }

  if ($tabs = theme('menu_local_tasks')) {
    $xtemplate->template->assign("tabs", $tabs);
    $xtemplate->template->parse("header.title.tabs");
  }

  if ($title = drupal_get_title()) {
    $xtemplate->template->assign("title", $title);
    $xtemplate->template->assign("breadcrumb", theme("breadcrumb", drupal_get_breadcrumb()));
    $xtemplate->template->parse("header.title");
  }

  if ($help = menu_get_active_help()) {
    $xtemplate->template->assign("help", $help);
    $xtemplate->template->parse("header.help");
  }

  if ($message = theme_status_messages()) {
    $xtemplate->template->assign("message", $message);
    $xtemplate->template->parse("header.message");
  }

  if (theme_get_setting('toggle_search')) {
    $xtemplate->template->assign(array(
      //"search" => search_form(),
      "search_url" => url("search"), 
      "search_button_text" => t("Search"), 
      "search_description" => t("Enter the terms you wish to search for."), 
      "form_token" => form_token(),
    ));
    $xtemplate->template->parse("header.search_box");
  }

  // only parse the mission block if we are on the frontpage ...
  if ($_GET["q"] == variable_get("site_frontpage", "node") && theme_get_setting('toggle_mission') && ($mission = theme_get_setting('mission'))) {
    $xtemplate->template->assign("mission", filter_xss($mission));
    $xtemplate->template->parse("header.mission");
  }

  if ($blocks = theme("blocks", "left")) {
    $xtemplate->template->assign("blocks", $blocks);
    $xtemplate->template->parse("header.blocks");
  }

  $xtemplate->template->parse("header");
  $output = $xtemplate->template->text("header");

  $output .= "\n<!-- begin content -->\n";
  $output .= $content;
  $output .= "\n<!-- end content -->\n";

  if ($blocks = theme("blocks", "right")) {
    $xtemplate->template->assign("blocks", $blocks);
    $xtemplate->template->parse("footer.blocks");
  }

  // only parse the footer block if site_footer is set
  if ($footer_message = variable_get("site_footer", FALSE)) {
    $xtemplate->template->assign("footer_message", $footer_message);
    $xtemplate->template->parse("footer.message");
  }

  $xtemplate->template->assign("footer", theme_closure());
  $xtemplate->template->parse("footer");

  $output .= $xtemplate->template->text("footer");

  return $output;
}
Login or register to post comments