Posted by nicktr on July 3, 2011 at 5:05am
I'm displaying a block with an image throughout my site, however, on certain pages, the image doesn't display.
I figured out that this is because the path is changed for clean url's so '/content/' is added to urls for things like 'about' pages and other nodes on the site
I think I need to use the base_path() function to solve this but i'm not quite sure how to use it.
The link i need to change is:
<a href="node/add/item-request"><img src="sites/default/files/headerbanner/request-item-button.png"></a>
How would I use base_path()? to solve this issue?
Thanks,
Nick

Comments
you need to use <?php echo
you need to use
<?phpecho nase_path();
?>
or, javascript have base_path in:
Drupal.settings.basePathJoetsui's blog
Worked perfectly! Thanks
Worked perfectly!
Thanks Joe.
Nick.
For an editable block it's
For an editable block it's best not to use PHP or JavaScript (stability, security, performance, and maintainability issues). Better just to use an absolute path:
<a href="/content/node/add/item-request"><img src="/content/sites/default/files/headerbanner/request-item-button.png"></a>If what you are trying to do cannot be done without PHP or JavaScript I'd recommend writing up a custom module and implementing hook_block_info() and hook_block_view().
--
Dave Hansen-Lange
Director of Technical Strategy, Advomatic.com
Pronouns: he/him/his
Agree with Dave. It's never a
Agree with Dave. It's never a good choice to store php or javascript code in the database.
Julien Didelet
Founder
Weblaa.com