0

In the page displayed, there is a row of buttons that each say "Submit Query."

enter image description here

The HTML for one of these buttons is:

<INPUT TYPE="image" SRC="../images/OneLine30px.png" CLASS="select-button" ID="OneLine">`

I've also tried slightly modifying the paths to these images. This HTML is in a .tpl.php file which is inside the templates directory. The images directory is a sibling of the templates directory.

  1. Why is Drupal displaying "Submit Query" instead of the image?
  2. How can I get Drupal to display the images?
2
  • By the way, that "Submit Query" text is a browser default for image-type inputs that don't have a valid "src" image. Drupal isn't doing that. Fixing the "src" attribute should be enough. – Les Lim Jun 6 '15 at 20:31
  • If the image is in the theme folder have a look at How can I get an absolute path to a theme? – J. Reynolds Jun 7 '15 at 6:29
2

I'd strongly advise to use CSS for this, it's much more easier to apply and you won't hit path related issues.

1
  • Agreed. It is best practice which allows for the themers to have greater freedom. Sometimes site builders are doing everything and best practices fall by the wayside, but what happens when the site is handed over to someone else where the division between coders/builders/themers are in effect. – J. Reynolds Jun 7 '15 at 6:36
0

Your "src" attribute is a relative path, but on the web, it won't be relative to the "templates" directory where your tpl.php file lives. It will be relative to the current URL path, instead.

Try using absolute paths starting with "/", and see if that gets the images showing.

4
  • Absolute paths are not working... Any other ideas? – CodeKingPlusPlus Jun 6 '15 at 3:56
  • Are you including the "/drupal-7.15/" in the absolute URL? – Les Lim Jun 6 '15 at 4:23
  • yes, here is the tag I am using: <INPUT TYPE="image" SRC="/var/www/html/drupal-7.15/sites/all/modules/lewis/images/OneLine30px.png"> – CodeKingPlusPlus Jun 6 '15 at 4:38
  • 2
    @CodeKingPlusPlus that looks like a server path, not a site path - most Drupal installs would begin at the parent of sites, not 4 generations up from that – Geoff Jun 6 '15 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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