I'm new at PHP, and I'm trying to redefine the $logo variable, but only for IE. Essentially I want my regular logo to be a PNG graphic with transparency, which won't be supported by IE, so I would like to substitute an alternative logo file for those browsers.

I think I need to introduce a preprocessor function into the template.php, but I'm not entirely sure that is correct. If it is correct I'm obviously not doing it right as I got a parsing error and the site wouldn't load at all. Here's what I've tried to put into template.php (the second half was more or less a guess as I couldn't find anything similar to base it off of).

function marinelli_preprocess_logo(&$vars) {
$vars['logo']=url('sites/default/files/logoalternate.jpg');
}

function marinelli_preprocess_logo(&$vars) {
$vars['logo']=url('sites/default/files/logoalternate.jpg');
}

Any suggestions on how to go about this? Thanks!

Comments

stevenc’s picture

There is no "preprocess_logo" hook. The variable you are looking for is managed via "preprocess_page"

Reference:
http://api.drupal.org/api/function/template_preprocess_page/6

About 1/2 down the list of $variables

---------------------------------
Steven Wright

Slalom

MJD’s picture

Deleted ... missed the second half of your requirement... will get back shortly

martin@drupal.org.uk’s picture

MJD’s picture

in your template.php you need the following:-

<?php 
function phptemplate_preprocess_page(&$vars) {

if (//your browser test logic){

  $vars['logo']="sites/default/files/logoalternate.jpg";
}
return $vars;
}
?>

or the pngfix as suggested by Martin...it's up to you

Anonymous’s picture

Thanks everyone for the different suggestions. I couldn't get any of the $logo redefine code to work, but then again I am a complete newb at php.

The pngfix module however seems to work beautifully. I've only tested it so far in FF and IE6, so here's hoping nothing funny happens in the other browsers.

Now on to decipher why the drupal site search doesn't show up in IE...

Thanks!