From e62e3417f7cbdbb1206f20f2f663b606a2b7b12a Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Sat, 14 Jul 2001 01:01:45 +0000 Subject: Update of the box function in themes to allow a difference in style/output/look of a box() depending on the position on the page. Basically this is a 'nice version' of a hack that you could do as a theme author. I've updated all the standard themes, but 3rd party themes will of course have to be updated by their authors, in the following manner: - Replace the box() declaration: < function box($subject, $content) { > function box($subject, $content, $region = "main") { - Replace the theme_account call: < theme_account($this); > theme_account("region", $this); Note that you'll have to replace "region" with the correct region that the box is placed in. However if you have a one-column theme, you should use "all", and not for example "left" (if all boxes are on the left). Usually the "region" here should be the same as the nearest theme_blocks() call. Those theme authors who want to can make boxes that appear in the center look different from those that appear in the sides for example. --- includes/theme.inc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'includes') diff --git a/includes/theme.inc b/includes/theme.inc index cb071bdb6..e78f313c1 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -18,7 +18,7 @@ function theme_init() { return new Theme(); } -function theme_account($theme) { +function theme_account($region, $theme) { global $user; if ($user->id) { @@ -48,7 +48,7 @@ function theme_account($theme) { $content .= "". t("logout") ."\n"; $content .= "\n"; - $theme->box($user->userid, $content); + $theme->box($user->userid, $content, $region); } else { $output .= "
\n"; @@ -60,7 +60,7 @@ function theme_account($theme) { $output .= " \n"; $output .= "
\n"; - $theme->box(t("Login"), $output); + $theme->box(t("Login"), $output, $region); } } @@ -72,7 +72,7 @@ function theme_blocks($region, $theme) { case "/node.php": if ($region != "left") { if ($user->id) $node = db_fetch_object(db_query("SELECT * FROM node WHERE nid = '$id'")); - if ($node->status == $status[queued]) theme_moderation_results($theme, $node); + if ($node->status == $status[queued]) theme_moderation_results($theme, $node, $region); } break; case "/index.php": @@ -80,13 +80,13 @@ function theme_blocks($region, $theme) { else $result = db_query("SELECT * FROM blocks WHERE status = 2". (($region == "left" || $region == "right") ? ($region == "left" ? " AND region = 0" : " AND region = 1") : "") ." ORDER BY weight"); while ($block = db_fetch_object($result)) { $blocks = module_invoke($block->module, "block"); - $theme->box(t($blocks[$block->offset]["subject"]), $blocks[$block->offset]["content"]); + $theme->box(t($blocks[$block->offset]["subject"]), $blocks[$block->offset]["content"], $region); } break; } } -function theme_moderation_results($theme, $node) { +function theme_moderation_results($theme, $node, $region) { foreach (explode(",", $node->users) as $vote) { if ($vote) { $data = explode("=", $vote); @@ -94,7 +94,7 @@ function theme_moderation_results($theme, $node) { } } - $theme->box(t("Moderation results"), ($output ? $output : t("This node has not been moderated yet."))); + $theme->box(t("Moderation results"), ($output ? $output : t("This node has not been moderated yet.")), $region); } ?> -- cgit v1.2.3