summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-08-16 18:06:18 +0000
committerDries Buytaert <dries@buytaert.net>2005-08-16 18:06:18 +0000
commit26fa7c730f878220a46478c47f6145f459f68688 (patch)
tree16c0ce7230150b0f8cee0f4d360c9756f8746764 /themes
parent6ef678e4475c6e500b371be6f5a9a66115686480 (diff)
downloadbrdo-26fa7c730f878220a46478c47f6145f459f68688.tar.gz
brdo-26fa7c730f878220a46478c47f6145f459f68688.tar.bz2
- Patch #16216 by nedjo: multiple block regions!
Diffstat (limited to 'themes')
-rw-r--r--themes/bluemarine/page.tpl.php3
-rw-r--r--themes/chameleon/chameleon.theme7
-rw-r--r--themes/engines/phptemplate/phptemplate.engine34
-rw-r--r--themes/pushbutton/page.tpl.php5
4 files changed, 45 insertions, 4 deletions
diff --git a/themes/bluemarine/page.tpl.php b/themes/bluemarine/page.tpl.php
index 4cc160073..0c634e5d5 100644
--- a/themes/bluemarine/page.tpl.php
+++ b/themes/bluemarine/page.tpl.php
@@ -30,6 +30,9 @@
</form><?php } ?>
</td>
</tr>
+ <tr>
+ <td colspan="2"><div><?php print $header ?></div></td>
+ </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" id="content">
diff --git a/themes/chameleon/chameleon.theme b/themes/chameleon/chameleon.theme
index cc0dce0b2..26d5a0ddc 100644
--- a/themes/chameleon/chameleon.theme
+++ b/themes/chameleon/chameleon.theme
@@ -16,6 +16,13 @@ function chameleon_features() {
'toggle_secondary_links');
}
+function chameleon_regions() {
+ return array(
+ 'left' => t('left sidebar'),
+ 'right' => t('right sidebar')
+ );
+}
+
function chameleon_page($content) {
$language = $GLOBALS['locale'];
diff --git a/themes/engines/phptemplate/phptemplate.engine b/themes/engines/phptemplate/phptemplate.engine
index dde0ae2f7..366420fdd 100644
--- a/themes/engines/phptemplate/phptemplate.engine
+++ b/themes/engines/phptemplate/phptemplate.engine
@@ -18,6 +18,22 @@ function phptemplate_templates($directory = 'themes') {
}
/**
+ * Declare the available regions implemented by this engine.
+ *
+ * @return
+ * An array of regions. The first array element will be used as the default region for themes.
+ */
+function phptemplate_regions() {
+ return array(
+ 'left' => t('left sidebar'),
+ 'right' => t('right sidebar'),
+ 'content' => t('content'),
+ 'header' => t('header'),
+ 'footer' => t('footer')
+ );
+}
+
+/**
* Execute a template engine call.
*
* Each call to the template engine has two parts. Namely preparing
@@ -68,6 +84,7 @@ function _phptemplate_callback($hook, $variables = array(), $file = null) {
* A sequential array of variables passed to the theme function.
*/
function _phptemplate_default_variables($hook, $variables) {
+ global $theme;
static $count = array();
$count[$hook] = is_int($count[$hook]) ? $count[$hook] : 1;
$variables['zebra'] = ($count[$hook] % 2) ? 'odd' : 'even';
@@ -79,7 +96,18 @@ function _phptemplate_default_variables($hook, $variables) {
$variables['block_zebra'] = ($count['block_counter'][$sidebar_indicator] % 2) ? 'odd' : 'even';
$variables['block_id'] = $count['block_counter'][$sidebar_indicator]++;
}
-
+ elseif ($hook == 'page') {
+ $regions = system_region_list($theme);
+ // Load all region content assigned via blocks.
+ foreach (array_keys($regions) as $region) {
+ // Skip blocks in this region that have already been loaded.
+ // This pre-loading is necessary because phptemplate uses variable names different from
+ // the region names, e.g., 'sidebar_left' instead of 'left'.
+ if (!in_array($region, array('left', 'right', 'footer'))) {
+ $variables[$region] .= theme('blocks', $region);
+ }
+ }
+ }
// Tell all templates where they are located.
$variables['directory'] = path_to_theme();
@@ -128,7 +156,7 @@ function phptemplate_page($content) {
$layout = 'none';
global $sidebar_indicator;
/**
- * Sidebar_indicator tells the block counting code to count sidebars seperately.
+ * Sidebar_indicator tells the block counting code to count sidebars separately.
*/
$sidebar_indicator = 'left';
$sidebar_left = theme('blocks', 'left');
@@ -158,7 +186,7 @@ function phptemplate_page($content) {
'breadcrumb' => theme('breadcrumb', drupal_get_breadcrumb()),
'closure' => theme('closure'),
'content' => '<!-- begin content -->' . $content . '<!-- end content -->',
- 'footer_message' => variable_get('site_footer', FALSE),
+ 'footer_message' => variable_get('site_footer', FALSE) . "\n" . theme('blocks', 'footer'),
'head' => drupal_get_html_head(),
'head_title' => implode(' | ', $head_title),
'help' => theme('help'),
diff --git a/themes/pushbutton/page.tpl.php b/themes/pushbutton/page.tpl.php
index dc3c6c9a5..88a3d2783 100644
--- a/themes/pushbutton/page.tpl.php
+++ b/themes/pushbutton/page.tpl.php
@@ -54,7 +54,10 @@
</form>
<?php endif; ?>
</td>
- </tr>
+ </tr>
+ <tr>
+ <td colspan="2"><div><?php print $header ?></div></td>
+ </tr>
</table>
<table id="content" border="0" cellpadding="15" cellspacing="0" width="100%">