How to set a automatically base url? |
[eluser]UdayD[/eluser]
hi! i dont know whether u got my problem or not. but i wrote this in autoload.php code as Code: $autoload['helper'] = array('url'); i wrote the image tag as Code: <img src="images/catch-me.gif"> but now if i write Code: <img src="$base/images/catch-me.gif">
[eluser]UdayD[/eluser]
@Ivar89 i did that but actually its not taking that also same problem persists even after adding /images
[eluser]Ivar89[/eluser]
really...:S then eeuhm..I mean what your map structure? its working fine for me...:S
[eluser]pbreit[/eluser]
If you "View Source" of the resulting page, what do you see in the <img> tag? If you put that image URL in your browser does it show the image?
[eluser]UdayD[/eluser]
in my view source i can see <i m g src='images/ctachme.gif'> but logically i must be able to see my image as i have set the base url in my base tag
[eluser]pbreit[/eluser]
Where is your images directory? Is it at the same level as your "/system/" directory? Your directory structure should be something like: /htdocs/codeigniter/ /htdocs/codeigniter/index.php /htdocs/codeigniter/system/ /htdocs/codeigniter/images/ /htdocs/codeigniter/images/myimage.gif Can you view your image in your browser just with the URL: http://www.mysite.com/images/myimage.gif Are you rewriting your URLs in an .htaccess file to get rid of the "index.php" in your URLs? Also, you might try everything without <base> tags (which are generally unnecessary). Finally, if you put your code in "code" tags, the forum software will not filter it and it will be easier to read.
[eluser]UdayD[/eluser]
actually i can see the images when i browse url http://www.mysite.com/images/myimage.gif Also i have the directory structure as mentioned. But i did not get the point of .htaccess. i use a wamp server. Can u tell me what have to be changed in .htaccess file.? Also i used the code tag to write the tags still the same problem was persisting.
[eluser]pbreit[/eluser]
Is your page publicly available so we could see it? Can you try removing any <base> tags. Does it work if you hardcode the <img> src to "/images/myimage.gif" or "http://www.mysite.com/images/myimage.gif"? |
Welcome Guest, Not a member yet? Register Sign In |