Image Path and Links in View-Files |
[eluser]noro[/eluser]
Hiho, I have an noob question. If i declare an Image File i have to write for example: <img src="<?=base_url();?>image/btn_left.gif" /> My designer starts to hate me The Image Folder is in the root of CI. Can I write it more easy?
[eluser]xzela[/eluser]
Check out the Snappy_Source helper: http://codeigniter.com/wiki/Snappy_Source/ It's a pretty good helper for loading images and scripts.
[eluser]ChangedNames[/eluser]
Something I tend to do is use absolute paths to the root of the website and if the images folder doesn't actually reside there re-route with .httpd or .htaccess. This is an apache approach but it would be something like this: Code: <img src="/images/foo.jpg"/> foo.jpg actually resides in /system/application/views/images/foo.jpg so I send it that way with .htaccess like this: Code: RewriteCond %{REQUEST_FILENAME} !-f
[eluser]noro[/eluser]
Ok, I will try the Mod_rewrite version. Snappy seems to be a goog helper if you use not so much pictures. Maybe I move my Homepage pictures into the view Folder, that would make it much easier.
[eluser]noro[/eluser]
Ok, now I am very confused. My Pictures are in the Root Folder, I changed nothing (nothing I noticed) and now I can write src="image/Picture.jpg" and get the picture.. intresting and perfect ^^ |
Welcome Guest, Not a member yet? Register Sign In |