By JasonMoreland on
Currently using this but I would like to make the link a picture
print( '<a href="/local/node/add/xyz/'. $node->nid.'" >Link Text</a>' );
tried
print( '<a href="/local/node/add/xyz/'. $node->nid.'" ><img src="images/link.gif" border="0"></a>' );
Doesn't seem to work. What have I done wrong?
Cheers
Comments
Relative Path
The src you are using above is not likely a valid path.
Images are usually stored either:
a) in you theme's directory, perhaps in an "images" subfolder. In this case, the src would be: "/sites/all/themes/mytheme/images/link.gif"
b) in the files area, if images are uploaded through the content area. In this care, the src may be: "/sites/default/files/images/link.gif"
Remember, any link defined in the HTML (images, javascript, css files, etc.) is always relative to the path of the current page as seen by the browser itself, not by where Drupal is executing the page.
---------------------------------
Steven Wright
Slalom
great thank you I'll try that
great thank you I'll try that out
Still No Image
Is the php correct could the picture not showing up be a css issue?
Also keep in mind...
When code references a resource (image etc.) from within a node, you have to preface the src= with "../".
Drupal l()
Use Drupal's l() function for links... The links are automatically going to be relative, it's clean and is best practice/the Drupal way.
This works:
What this says is
l(where the image is located, what the URL link should be, the code is html)Awsome Thank you
Excellent than you very much.