Hello.

I new in using PHP for theming.
I would like to change the web site logo just for one page called "special page" (and its translations).
I made a subtheme of Zen, in Drupal 7.12, Ubuntu Linux.
In page.tpl.php , I wrote:

	if( $title == "special page") : $logo = file_create_url(file_build_uri('images/special_logo.png')) ; endif;

In the source code of my page, I can see the right URI to that special logo, but the picture doesn't appear on the page and, if I read that URI in my browser, I get a Drupal page saying:

Page not found
The requested page "/sites/my_site.asia/files/images/special_logo.png" could not be found.

On the second and last comment of that page, I read:

For private files at least. You will need to implement hook_file_download() to allow the file to be downloaded. Otherwise you will get a file not found page.

Firstly I've never done that, secondly is it possible to implement such a function in a template? If yes, how should I name my function? What to do? Maybe my method is completely wrong…

Thank you for any help.

Comments

Fiable.biz’s picture

No body has any idea?

http://Fiable.biz Web site creation.

josephanoop’s picture

Usually the following code is used for showing logo,

<a href="<?php print $front_page ?>">
            <?php if ($logo): ?>
              <img src="<?php print $logo ?>" alt="<?php print $site_name_and_slogan ?>" title="<?php print $site_name_and_slogan ?>" id="logo" />
            <?php endif; ?>
            <?php print $site_html ?>
            </a>

In this case if you want to change logo for just one page, you can do it by using following condition

<a href="<?php print $front_page ?>">
            <?php if ($logo): ?>
   <?php  if (arg(0) =='specialpagearg1 ' &&  arg(1) =='specialpagearg2 ') {?>

         <img src="<?php print $base_path . path_to_theme() ?>/images/imagename.jpg" alt="<?php print $site_name_and_slogan ?>" title="<?php print $site_name_and_slogan ?>" id="logo" />

<?php } else{ ?>
              <img src="<?php print $logo ?>" alt="<?php print $site_name_and_slogan ?>" title="<?php print $site_name_and_slogan ?>" id="logo" />

            <?php } endif; ?>
        
            </a>

Where arg(0) and arg(1) is,
if your url is like yoursitename.com/content/specialpage
arg(0) is content
arg(1) is specialpage

path_to_theme() and $base_path, together form yoursitename.com/sites/all/themes/
/images/imagename

Hope this will clear your problem