From cfd31c93f1f4a4453f7f67e9bf5d3826f9cfce2f Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 1 Feb 2003 19:54:19 +0000 Subject: Patch by Ax: - Bad usage of css ID's: they may be used for a single element only, but were used as #node, #block, which can occur multiple times in a single page. - Moved HTML from theme to template - thats what templates are all about! - Added support for head() hook - Added support for diffentiating between boxes and blocks. - Typo: secundary -> secondary --- includes/theme.inc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'includes/theme.inc') diff --git a/includes/theme.inc b/includes/theme.inc index 7a023991a..d206c22ec 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -69,6 +69,12 @@ class BaseTheme { print $output; } + function block($subject, $content, $region = "main") { + global $theme; + + $theme->box($subject, $content, $region); + } + function footer() { $output = ""; $output .= ""; @@ -148,7 +154,13 @@ function theme_init() { return $obj; } -function theme_blocks($region, &$theme) { +/** + * Render blocks available for $user and $region calling $theme->block($region). + * + * @param string $region main|left|right + * @param + */ +function theme_blocks($region) { global $user, $PHP_SELF; $result = db_query("SELECT * FROM blocks WHERE (status = '1' OR custom = '1') ". ($region != "all" ? "AND region = '%s' " : "") ."ORDER BY weight, module", $region == "left" ? 0 : 1); @@ -157,7 +169,7 @@ function theme_blocks($region, &$theme) { if ((($block->status && (!$user->uid || !$block->custom)) || ($block->custom && $user->block[$block->module][$block->delta])) && (!$block->path || preg_match("|$block->path|", $PHP_SELF))) { $block_data = module_invoke($block->module, "block", "view", $block->delta); if ($block_data["content"]) { - $theme->box($block_data["subject"], $block_data["content"], $region); + theme_invoke("block", $block_data["subject"], $block_data["content"], $region); } } } -- cgit v1.2.3