I recently moved my site over from WAMP local server to my productions server (I will be building directly on the production server from now on! The bugs on a site that was complete before the move are driving me insane.

OK, my big problem is, on my page.tpl.php I have static images. I placed those images like so...
In the header...

<?php
	// Create a variable to hold the full path, in our theme, to the image.
	//   path_to_theme() takes care of creating the correct path for the active theme (which is likely your own custom one)
	$logoutIcon = path_to_theme() . '/sites/all/themes/CustomThemeName/images/logout.png';
	$contactIcon = path_to_theme() . '/sites/all/themes/CustomThemeName/images/contact.png';
	$contactUsIcon = path_to_theme() . '/sites/all/themes/CustomThemeName/images/LIContactUs.png';
?>

In the body

<img src="<?php print $logoutIcon ?>" class="logout imgLink" id="logout" alt="logout"/>
<img src="<?php print $contactIcon ?>" class="contact imgLink" id="contact" alt="contact"/>
<img src="<?php print $contactUsIcon ?>" alt="contact us" class="imgLink"/>

I took out all the code that wasn't pertinent to this question.

The images show up fine everywhere that the page is in the root - everywhere it's www.mywebaddress.com/pagename. The images do not show up anywhere you have to go through directories, ie - www.mywebaddress.com/blog/5 or www.mywebaddress.com/node/63

Any ideas on what I am doing wrong would be greatly appreciates... This was working on the local host. I have tried full static links www.mywebaddress.com/sites/all/themes/CustomThemeName/images/imagename.jpg and with and without the starting slash that is above.

If this information is needed, this is a multi-site install on onw drupal code base.

Thanks!

PS - I can't wait until I have learned enough I can start answering questions instead of just asking them!

Comments

kbalderson’s picture

Try putting the base path before the path_to_theme() function is called.

$logoutIcon = $base_path . path_to_theme() . '/sites/all/themes/CustomThemeName/images/logout.png';

http://api.drupal.org/api/global/base_path/6

otherwise the browser tries to call the files relative to the directory it thinks you are in, which isn't really a directory, since drupal creates pages dynamically.

CoderGirl’s picture

I tried this...
$logoutIcon = $base_path . path_to_theme() . '/sites/all/themes/LoggedInCenterStreet/images/logout.png';
then ran cron, and cleared my cache, it still doesn't work.

log121’s picture

Did the same - same result.
You can check this out - http://microcraft.com.ua/

CoderGirl’s picture

I got this fixed. This advice worked, after I fixed a tiny typo. Thanks :D

zbricoleur’s picture

Look at what is actually output by path_to_theme() . '/sites/all/themes/CustomThemeName/images/LIContactUs.png'. I suspect it's something like '/sites/all/themes/CustomThemeName/sites/all/themes/CustomThemeName/images/LIContactUs.png'--i.e., you've already hard-coded the path to the theme and you're prefixing it again with the path_to_theme function.

CoderGirl’s picture

This is what the actual output is - sites/all/themes/LoggedInCenterStreet/images/logout.png