Never mind, found the problem. The drupal_get_path call is wrong. I am using $GLOBALS['base_path'] now instead, and all is fine. Ursula
I am trying to add an additional logo to my D7 site.
I added to the template.php the following:
function mytheme_preprocess_page(&$variables, $hook) {
$theme_path = drupal_get_path('theme', variable_get('theme_default', NULL));
$variables['second_logo'] = $base_path . '/' . $theme_path . '/images/second_logo.png';
}
and on page.tpl.php, I use the variable $second_logo, which correctly goes to:
http://example.com/drupal_site/sites/all/themes/mytheme/images/second_logo.png
This works fine for the home page:
http://example.com/drupal_site/sites/all/themes/mytheme/images/second_logo.png
However, when I am looking at a content page:
http://example.com/drupal_site/content/whateverpage
The url for the second logo gets constructed as:
http://example.com/drupal_site/content/sites/all/themes/mytheme/images/second_logo.png
So, I add the base path to template.php:
$base_path = drupal_get_path('theme', variable_get('base_path', NULL));
$theme_path = drupal_get_path('theme', variable_get('theme_default', NULL));
$variables['second_logo'] = $base_path . '/' . $theme_path . '/images/second_logo.png';
base_path, according to http://api.drupal.org/api/drupal/globals/7 is supposed to bet the base of the Drupal installation, which in my case is http://example.com/drupal_site/
However, the path for the second logo gets constructed as:
http://example.com/sites/all/themes/mytheme/images/second_logo.png
instead of
http://example.com/drupal_site/sites/all/themes/mytheme/images/second_logo.png
D7.15, zen 7.15 sub-theme.
What am I don't wrong?
Thanks, Ursula