[support] theme preprocessing - path issue
Ursula Pieper
dramamezzo at gmail.com
Sat Aug 25 00:50:47 UTC 2012
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20120824/8a9f407c/attachment.html
More information about the support
mailing list