I want to display two different logos on my drupal site: one for the front page and one for the inner pages.
if (drupal_is_front_page()) {
$variables['logo']=drupal_get_path('theme', 'hanna') . '/images/logo.png';
}
else {
$variables['logo']=drupal_get_path('theme', 'hanna') . '/images/logo-inner.png';
}
This works just fine for the front page and any page which has websiteurl/page as URL; however, it doesn't work for the pages where the URL is similar to websiteurl/custompath/page.
I think the problem lies in the relativeness of the pages which have a custom URL path.
Do you have any idea?
You can use the drupal global $base_url
to get the absolute path of the installation and append the absolute path of your image to it.
See the Drupal Documentation to this topic.
You can also use base_path() to get the path.