diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-05-18 13:22:00 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-05-18 13:22:00 +0000 |
commit | a1c0d416814bff336a83626c8c8c32331b82f00f (patch) | |
tree | f0426127cb54728865b028af396c3656ef9b91cd | |
parent | d54465b80028eb69e8a45c26949a2a85b4b78c07 (diff) | |
download | brdo-a1c0d416814bff336a83626c8c8c32331b82f00f.tar.gz brdo-a1c0d416814bff336a83626c8c8c32331b82f00f.tar.bz2 |
- Added option to control placement of sidebar(s).
-rw-r--r-- | themes/xtemplate/xtemplate.theme | 40 | ||||
-rw-r--r-- | themes/xtemplate/xtemplate.xtmpl | 7 |
2 files changed, 41 insertions, 6 deletions
diff --git a/themes/xtemplate/xtemplate.theme b/themes/xtemplate/xtemplate.theme index d0bf0c053..60d51406f 100644 --- a/themes/xtemplate/xtemplate.theme +++ b/themes/xtemplate/xtemplate.theme @@ -1,11 +1,12 @@ <?php function xtemplate_settings() { - $output = form_textarea("Message on front page", "xtemplate_message", variable_get("xtemplate_message", "edit message"), 70, 6, "This text will be displayed on the front page. It can be used to display a mission statement, announcement or site description.."); + $output = form_select("Sidebar placement", "xtemplate_sidebar", variable_get("xtemplate_sidebar", "right"), array("none" => t("No sidebars"), "left" => t("Sidebar on the left"), "right" => t("Sidebar on the right"), "both" => t("Sidebar on the left and the right"))); + $output .= form_textarea("Message on front page", "xtemplate_message", variable_get("xtemplate_message", "edit message"), 70, 6, "This text will be displayed on the front page. It can be used to display a mission statement, announcement or site description.."); $output .= form_textarea("Primary links", "xtemplate_primary_links", variable_get("xtemplate_primary_links", l("edit primary links", "admin/system/themes/xtemplate")), 70, 6, "The primary links."); $output .= form_textarea("Secondary links", "xtemplate_secondary_links", variable_get("xtemplate_secondary_links", l("edit secondary links", "admin/system/themes/xtemplate")), 70, 6, "The secondary links."); $output .= form_select("Search box", "xtemplate_search_box", variable_get("xtemplate_search_box", 0), array(t("Disabled"), t("Enabled")), "Show a search box in the upper right corner."); - return $output; + return $output; } class Theme_xtemplate extends BaseTheme { @@ -22,6 +23,8 @@ class Theme_xtemplate extends BaseTheme { include_once("themes/xtemplate/xtemplate.inc"); } + $this->sidebar = variable_get("xtemplate_sidebar", "right"); + $this->template = new XTemplate("themes/xtemplate/xtemplate.xtmpl"); $this->template->SetNullBlock(" "); // "" doesnt work! } @@ -80,6 +83,7 @@ class Theme_xtemplate extends BaseTheme { "primary_links" => variable_get("xtemplate_primary_links", l("edit primary links", "admin/system/themes/xtemplate")), "secondary_links" => variable_get("xtemplate_secondary_links", l("edit secondary links", "admin/system/themes/xtemplate")) )); + if (variable_get("xtemplate_search_box", 1)) { $this->template->assign(array( //"search" => search_form(), @@ -94,8 +98,26 @@ class Theme_xtemplate extends BaseTheme { $this->template->parse("header.message"); } + ob_start(); + + if ($this->sidebar == "left") { + theme_blocks("all"); + } + else if ($this->sidebar == "both") { + theme_blocks("left"); + } + + if ($blocks = ob_get_contents()) { + $this->template->assign("blocks", $blocks); + $this->template->parse("header.blocks"); + } + + ob_end_clean(); + $this->template->parse("header"); print $this->template->text("header"); + + } function block($title, $content, $region = "main") { @@ -122,15 +144,23 @@ class Theme_xtemplate extends BaseTheme { } function footer() { - // unfortunately, theme_blocks PRINTS the blocks instead of RETURNING them. - // so we need some output buffering + ob_start(); - theme_blocks("all"); + + if ($this->sidebar == "right") { + theme_blocks("all"); + } + else if ($this->sidebar == "both") { + theme_blocks("right"); + } + if ($blocks = ob_get_contents()) { $this->template->assign("blocks", $blocks); $this->template->parse("footer.blocks"); } + ob_end_clean(); + $this->template->assign( array( "footer_message" => variable_get("site_footer", ""), "footer" => theme_footer() diff --git a/themes/xtemplate/xtemplate.xtmpl b/themes/xtemplate/xtemplate.xtmpl index 287739d42..f8be0756b 100644 --- a/themes/xtemplate/xtemplate.xtmpl +++ b/themes/xtemplate/xtemplate.xtmpl @@ -32,11 +32,16 @@ </table> <table border="0" cellpadding="0" cellspacing="0" class="header"> <tr> + <!-- BEGIN: blocks --> + <td valign="top" id="sidebar"> + {blocks} + </td> + <!-- END: blocks --> <td valign="top"> <!-- BEGIN: message --> <div id="message">{header_message}</div> <!-- END: message --> - <div id="main"> + <div id="main"> <!-- END: header --> <!-- BEGIN: node --> |