- Added option to control placement of sidebar(s).
parent
d54465b800
commit
a1c0d41681
|
@ -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()
|
||||
|
|
|
@ -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 -->
|
||||
|
|
Loading…
Reference in New Issue