hello everybody,

i would like to build a 2-column fixed layout with zen, left column=navigation, right column=content.
i want the logo to appear in the left sidebar, just over the navigation-menu and the content-area should reach to the top of the viewport (i.e. the logo should stay only in the left column, not covering the content-area).
i did override the page.tpl.php to re-arrange the output-order of the logo, but i didn't get it.
can someone give me a hint what to change in page.tpl.php / css?

thanks a lot!
adam

Comments

progpapa’s picture

Copy region--sidebar.tpl.php from the zen templates folder to your theme templates folder and rename it to region--sidebar-first.tpl.php. Then try copy/pasting the code that displays the logo from page.tpl.php to region--sidebar-first.tpl.php. Place it just above this line:
<?php print $content; ?>

adam1’s picture

thanks for your advice, progpapa.
the region--sidebar-first.tpl.php is the correct template, but there is one problem: the logo is not rendered.
when i put <?php print $logo; ?> into the region--sidebar-first.tpl.php the rendered path is an empty string (the same code rendered in the page.tpl.php outputs the correct path to the logo-image).

what am i missing?
thanks, adam

mcfilms’s picture

Wouldn't it be easier to put your logo in a block and a block in the sidebar. Then put your menu block below it in the sidebar. Then turn off the "logo" settings for your theme?

A list of some of the Drupal sites I have designed and/or developed can be viewed at motioncity.com

adam1’s picture

but the logo has to be changeable by a non-techie-person.
i don't know at all, how to use blocks for this purpose ... till now i only worked with content-types, never with custom blocks - but i would like to learn more about it, mabe you have an url for a tutorial?

nevertheless i am courios, why the $logo-variable doesn't work in region--sidebar-first.tpl.php.
thank you guys, its a great forum!

adam

mcfilms’s picture

Blocks are great because you can make them appear (or not) based on the path and they are really easy to use.I don't have a tutorial, but I think if you just try it you'll like it.

In terms of a replaceable image in a block, I haven't used this module, but it seems pretty straight-forward. http://drupal.org/project/imageblock The good thing about this module is it runs the logo through imagecache, so they can't insert a giant image and destroy your layout.

EDIT: Maybe that module isn't exactly the perfect answer. Be sure to look at the issue cue first and test the uploaded images.

A list of some of the Drupal sites I have designed and/or developed can be viewed at motioncity.com

adam1’s picture

thank you, mcfilms.
despite i will realize the actual problem by using the suggested template-method, the image-block module is great and works like a charm.

adam

progpapa’s picture

Forgot about that. You'll need to add a few lines to your template.php file too. See here: http://drupal.org/node/1325916#comment-5178416
In this thread you'll also see how to put your logo in a block and still be able to change it as you normally would.
(I'd prefer the template file, though.)

adam1’s picture

the $logo-variable is still not available in the region--sidebar-first.tpl.php

summary of the steps i've done:

i use a zen-subtheme, in the sub-theme-folder i added following code to the template.php:

$variables['logo'] = theme_get_setting('logo');
$variables['front_page'] = variable_get('site_frontpage', 'node');

i moved the logo-producing-code from page.tpl.php to the new region--sidebar-first.tpl.php file which i copied from the zen-base-theme to templates-folder of my subtheme, but
print $logo;
still prints an empty string.
i rebuilt theme-registry and cleared all caches ...

whats wrong?
thanks progpapa - nomen est omen!
adam

progpapa’s picture

Did you put the code into the preprocess function?
The above code goes into a preprocess function in the template.php file.
It should look something like this:

function yourthemename_preprocess_region(&$variables, $hook) {
...
$variables['logo'] = theme_get_setting('logo');
$variables['front_page'] = variable_get('site_frontpage', 'node');
...
}

This should make the $logo and $front_page variables available in your tpl.php file.

adam1’s picture

That's it!
Thank you very much, i learned a lot.

adam

car3oon’s picture

Shouldn't it be rather like that:

function yourthemename_preprocess_region(&$variables, $hook)
{
    $variables['logo'] = theme_get_setting('logo');
    $variables['front_page'] = url();
}

?
Because your front_page variable returns "node" not "/".