Jump to:
| Project: | Block Bar |
| Version: | 5.x-0.1 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
I tried to figure out how to use it for my garland-based site, but the examples given, in the readme text & even that screencam(?) use a template.php which is much easier to understand than that of the Garland theme.
I failed to get it to work.
I failed to do this step
1. Create a "container region" in your template.php. The sole purpose
of this new region is to act as a container for your blockbar elements
(ie normal blocks)
& its expansion:
function my_theme_regions() {
return array(
'left' => t('left sidebar'),
'right' => t('right sidebar'),
'content' => t('content'),
'header' => t('header'),
'footer' => t('footer'),
'blockbar_container_1' => t('blockbar_container_1'),
'blockbar_container_2' => t('blockbar_container_2')
);
}
Assuming I want 14 blocks, & did everything right in those instructions except the steps that depend directly on those quoted instructions, WHAT EXACTLY should be included in the Garland template.php code which is below AND WHERE?
<?php
/**
* Sets the body-tag class attribute.
*
* Adds 'sidebar-left', 'sidebar-right' or 'sidebars' classes as needed.
*/
function phptemplate_body_class($sidebar_left, $sidebar_right) {
if ($sidebar_left != '' && $sidebar_right != '') {
$class = 'sidebars';
}
else {
if ($sidebar_left != '') {
$class = 'sidebar-left';
}
if ($sidebar_right != '') {
$class = 'sidebar-right';
}
}
if (isset($class)) {
print ' class="'. $class .'"';
}
}
/**
* Return a themed breadcrumb trail.
*
* @param $breadcrumb
* An array containing the breadcrumb links.
* @return a string containing the breadcrumb output.
*/
function phptemplate_breadcrumb($breadcrumb) {
if (!empty($breadcrumb)) {
return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
}
}
/**
* Allow themable wrapping of all comments.
*/
function phptemplate_comment_wrapper($content, $type = null) {
static $node_type;
if (isset($type)) $node_type = $type;
if (!$content || $node_type == 'forum') {
return '<div id="comments">'. $content . '</div>';
}
else {
return '<div id="comments"><h2 class="comments">'. t('Comments') .'</h2>'. $content .'</div>';
}
}
/**
* Override or insert PHPTemplate variables into the templates.
*/
function _phptemplate_variables($hook, $vars) {
if ($hook == 'page') {
if ($secondary = menu_secondary_local_tasks()) {
$output = '<span class="clear"></span>';
$output .= "<ul class=\"tabs secondary\">\n". $secondary ."</ul>\n";
$vars['tabs2'] = $output;
}
// Hook into color.module
if (module_exists('color')) {
_color_page_alter($vars);
}
return $vars;
}
return array();
}
/**
* Returns the rendered local tasks. The default implementation renders
* them as tabs.
*
* @ingroup themeable
*/
function phptemplate_menu_local_tasks() {
$output = '';
if ($primary = menu_primary_local_tasks()) {
$output .= "<ul class=\"tabs primary\">\n". $primary ."</ul>\n";
}
return $output;
}I'm relatively new to php and so would appreciate precise instructions & code if possible.
Many thanks in advance. :)
Comments
#1
Hi,
I have the same problem: I don't know where to put the code in my template.php.
I use Drupal 5.1 and Garland theme.
Support highly appreciated.
Thanks,
mathilda
#2
It's supposed to be placed at the end of template.php. Rename the function to garland_regions():
function garland_regions() {return array(
'left' => t('left sidebar'),
'right' => t('right sidebar'),
'content' => t('content'),
'header' => t('header'),
'footer' => t('footer'),
'blockbar_container_1' => t('blockbar_container_1'),
'blockbar_container_2' => t('blockbar_container_2')
);
}
#3
Many Thanks, MentalFS.
I will try later and let you know the result.
#4
I figuerd that DHTML menu module does the same as block bar.
#5
I am still unable to get blockbar to work with the Garland theme on my 5.x Drupal site. I tried adding the code to the end of my template.php as instructed by MentalFS but it didn't work. I'm not sure what i need to rename? I don't know php so I can only follow detailed instructions at this point. (I did look at the DHTML module and it does seem to be different than what I need.
#6
This is a Drupal region configuration issue, not a blockbar issue.