0

I am developing a drupal 7 site where 4 pages have url redirects from a parent page within the site. I have a block in the footer that is shown on all pages but the 4 pages mentioned above do not display the image within that block. I'm thinking that it must have something to do with the redirects as it is only these 4 pages that don't display the image. All other pages with that block show the image up just fine.

2
  • Well, most likely this image that is inside the block has a non-relative path? can you paste the block contents?
    – Pan Chrono
    Commented Jun 4, 2014 at 13:23
  • Here are the contents <div class="img-holder-getintouch"><img src="sites/default/files/footer-get-in-touch.png" alt="" width="250" height="291" /></div> etc.
    – kristin.e
    Commented Jun 4, 2014 at 14:08

2 Answers 2

0

In your situation a recommendation is to use relative path and not activate if this is your only reason the php as input type. Your code will be

div class="img-holder-getintouch"><img src="/sites/default/files/footer-get-in-touch.png" alt="" width="250" height="291" /></div> 

You will see that i added just a slash as of this tells the site to request the file from http://www.example.com/sites.... this way you can do a migration and the images will still work.

3
  • Are u sure that the site is/will always be hosted on apache/server document root?? This will not be valis if thats the case..
    – Pan Chrono
    Commented Jun 6, 2014 at 9:33
  • For more than enough situation this will be accepted solution. To activate php is also a solution but will involve some changes that is not necessary from the start. At the end user will decide what fit his need. Commented Jun 6, 2014 at 9:38
  • @Drupalizeme - Thanks for the extra slash advice - it worked a treat!
    – kristin.e
    Commented Jun 6, 2014 at 15:47
1

Well, this image will play nice only if you are in your homepage or something and then the relative path is as: http://site.com/sites/default/files/footer-get-in-touch.png

Off course this won't play for other paths as this is invalid

http://site.com/<PATH>/sites/default/files/footer-get-in-touch.png

Quick Solution:

Enable php filter module, to be able to write php inside the blocks contents and provide correct image path for all cases

<?php 
    global $base_path;
?>
<div class="img-holder-getintouch">
    <img src="<?php echo $base_path; ?>sites/default/files/footer-get-in-touch.png" alt="" width="250" height="291" />
</div>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.