By beckyjohnson on
I'm muddling along making a custom theme. My partner and I wanted to use the image header module for our site but the ImageField cck module is not up to date for 6.x. Anyway, so I thought I could use the <img src /> tag to link out to an image in my image folder. However, this is not working at all. I made a page-node-1.tpl.php file and wanted a different header on that from the one on my front page and it totally did not work at all. I know that my site is reading that page-node-1-.tpl.php, but it will not load any images I linked to using the <img src /> tag. Why is this?
If it helps, I am working on a localhost using xxamp.
Comments
=-=
to help, we will need to know where the image is being stored?
and exactly how you are referencing it with an img tag.
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )
Ok, well, my image is being
Ok, well, my image is being stored in a couple of folders so the img tag looks like this, with a div that handles positioning around it:
I have a block called image banner which defines this area but I'm not sure what to do with it....I was originally going to use my image banner region in conjunction with the header image module but a module it appears to depend on is not up to date yet.
Interestingly, I cannot even get my site logo showing up using the page found at themes > configure. I thought that had to do with how my localhost is set up though.
Becky
=-=
and the images folder is stored where ? at the drupal root ? in the theme folder ?
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )
The image folder is stored
The image folder is stored in xxampp>htdocs>drupal6>sites>all>themes>custom>name_of_my_site folder. It is in the same folder as my .info file, my screenshot and all of my page.tpl.php files.
Becky
How about
How about "sites/all/themes/custom/name_of_my_site/events01.jpg" ?
Since thats where you say your picture is located.
yes, I could try that but
yes, I could try that but if i have my images folder and all of it's sub directories in the same folder as my page.tpl.php file why would i need to be that specific? Why am I suddenly not able to link things relatively?
Im using xampp too and my
Im using xampp too and my theme is located in the theme folder, it's where I think it should be stored:
xampp\htdocs\drupal6\themes\my_theme
In all themes there is a folder called img. If you put a picture named pic.jpg in that folder the link would look like this:
For you it should look something like this:
I couldn't see your code.
I couldn't see your code. You forgot to wrap it in code tags.
somebody fast too fast.. I couldnt update my comment :-)
here it goes again:
Im using xampp too and my theme is located in the theme folder, it's where I think it should be stored:
xampp\htdocs\drupal6\themes\my_theme
In all themes there is a folder called img. If you put a picture named pic.jpg in that folder the link would look like this:
For you it should look something like this:
Use the API, Luke
Hardcode bad. Dynamic good.
http://api.drupal.org/api/function/path_to_theme/6
I don't understand what I'm
I don't understand what I'm looking at on that link. Could you explain a tad please?
Becky
=-=
The best way to explain it , is to have you seek out an example: Grab a theme that uses images in it, inspect the way these images are called into the tpl.php
_____________________________________________________________________
My posts & comments are usually dripping with sarcasm.
If you ask nicely I'll give you a towel : )
I don't get it either.
I don't get it either. Please explain what to do.
He means something
He means something like:
oh! interesting. Do I have
oh! interesting. Do I have to do anything special to the path_to_theme() or base_path() first?
Becky
update: WHoo hoo! It worked!
Thank you!
And thanks to everyone else who tried to help out!
Thanks!
Thanks!
Worked!
Hello,
Thank you cog.rusty...I was facing the exact same problem and your solution worked for me :) :)
Regards,
Supriya Rajgopal
But my images folder is in
But my images folder is in my name_of_my_site folder along with my page.tpl.php. So why can't I say
<img src "images/name_of_image" />? I even tried putting all the images on the top level with my page files and going<img src="name_of_image" />and it doesn't work.I have no idea but it just
I have no idea but it just doesnt work as you say but I also have very limited skills however I often manage to solve my problems.
It will work if you put the div tags in your php-file but the path to the picture in your css-file.
in style.css:
.divtag { background: url(images/events01.jpg); }
Relative links are resolved
Relative links are resolved by the user's browser, using the path of the page the user is on.
If you are using clean URLs, even the suggested link might fail if the user is on a page like node/35, for example. It would become:
node/35/sites/all/themes/custom/name_of_my_site/events01.jpg
In that case you would need a front slash too.
yeah.. that makes sense but
yeah.. that makes sense but I'm trying to link to an image outside of the drupal database. The images are not in a database they are just in a folder so....
Yes, I see... but the
Yes, I see... but the browser doesn't care where things comes from, only what is displayed.