How to set a automatically base url?

#11
[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');
and then from my main view
i wrote the image tag as
Code:
<img src="images/catch-me.gif">
now images are gone they are not visible.
but now if i write
Code:
<img src="$base/images/catch-me.gif">
(off course $base echoed in php tags but when i write here it wont show because of form filters of forum)

#12
[eluser]Ivar89[/eluser]
typ a "/" before images in your source

#13
[eluser]UdayD[/eluser]
@Ivar89
i did that but actually its not taking that also same problem persists even after adding
/images

#14
[eluser]Ivar89[/eluser]
really...:S then eeuhm..I mean what your map structure?
its working fine for me...:S

#15
[eluser]UdayD[/eluser]
even i dont know whts happening

#16
[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?

#17
[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

#18
[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 &lt;base&gt; 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.

#19
[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.

#20
[eluser]pbreit[/eluser]
Is your page publicly available so we could see it?

Can you try removing any &lt;base&gt; tags.

Does it work if you hardcode the <img> src to "/images/myimage.gif" or "http://www.mysite.com/images/myimage.gif"?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.