I'd like to replace the "site name" that is displayed on the theme (I'm currently using the barron theme) with a graphic. It will still be hyperlinked to go home, but I just want the graphical image instead.

I tried modifying page.tpl.php to point to an image, but it's still showing just the sitename using alt="". If I don't add the alt tag, no sitename or graphic is displayed.

Original:

<div id="logoWrapper">
            <?php if ($logo) { ?>
            <div id="logo"><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><img src="<?php print $logo ?>" alt="<?php print t('Home') ?>" /></a></div><?php } ?>
            <?php if ($site_name) { ?><div id="siteName"><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><?php print $site_name ?></a></div><?php } ?>
            <?php if ($site_slogan) { ?><div id="siteSlogan"><?php print $site_slogan ?></div><?php } ?>
        </div>

I'm sure this has been done before... any thoughts?

Thanks!!!

Comments

vm’s picture

that looks like stock code from drupal.

what was the code you "tried" to use ?

cdrees’s picture

That is the stock code, I was just using it as a point of reference...

What I'm wanting to do is replace this line

<a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><img src="images/myimage.png" alt="<?php print $site_name ?>" /></a>

So basically instead of showing the site name by default, it references the graphic image instead

vm’s picture

first thing I'd do, is replace the alt with a non php line. to test your theory that the alt is the problem. Thus hardcoding it. you can actually hardcode that entire line if you wanted, since you've already hardcoded the img src

I have a feeling the problem lies with the div you are adding this to ? which you didnt add to your code above. I assume its sitename. which is being controlled by the style.css file.

Steven_NC’s picture

Go to Administration > Site Building > Themes > Configure tab
disable Site Name
enable Logo
fill in Path to Custom Logo

no need to code anything.

Lars Vandergraaf’s picture

Thanks Steve!

niek_kloots’s picture

The following worked for me.
I use the bluemarine-themplate but I think it will work the same with your theme.

On (url)/themes/barron/page.tpl.php change the following line(s)
OLD:

<div id="container">
<div id="header">
<div id="logoWrapper">
<?php if ($logo) { ?>
<div id="logo"><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><img src="<?php print $logo ?>" alt="<?php print t('Home') ?>" /></a></div><?php } ?>

<?php if ($site_name) { ?><div id="siteName"><a href="<?php print $base_path ?>" title="<?php print t

('Home') ?>"><?php print $site_name ?></a></div><?php } ?>
<?php if ($site_slogan) { ?><div id="siteSlogan"><?php print $site_slogan ?></div><?php } ?>
</div>
<div id="nav">
<?php if (isset($primary_links)) { ?><?php print theme('menu_links', $primary_links) ?> <?php } ?>
</div>
</div>

NEW:

<div id="container">
<div id="header">
<div id="logoWrapper">
<?php if ($logo) { ?>
<div id="logo"><a href="<?php print $base_path ?>" title="<?php print t('Home') ?>"><img src="<?php print $logo ?>" alt="<?php print t('Home') ?>" /></a></div><?php } ?>

<h1 class='site-name'><img alt="yoursite.com" src="http://www.yoursite.com/images/titel_logo.jpg"></a></h1>

<?php if ($site_slogan) { ?><div id="siteSlogan"><?php print $site_slogan ?></div><?php } ?>
</div>
<div id="nav">
<?php if (isset($primary_links)) { ?><?php print theme('menu_links', $primary_links) ?> <?php } ?>
</div>
</div>

----------
Place a titel_logo on the site in the ../images

The side_name is displayed in the browser and the titel_logo is displayed in the header.

example: http://openwateralkmaar.nl

unscarred1925’s picture

I have tried this one using a Wabi theme BUT, if the link starts at www.sitename.com/node/xx or anything not included on your pathautho it will not show up. I have tried hardcoding the page.tpl but i have no success. Any idea on this?

vm’s picture

relative urls should be used not absolute. and images for the theme should be placed in the theme folder.