Attaching images to my web-page |
[eluser]2mato[/eluser]
Hello there I am trying to attaching images to my first CodeIgniter web-page :-), I am using this : 1- In config.php I configer the base url as shown ===> $config['base_url'] = "http://localhost/ci/"; 2- when adding an image to a view file i do like this ===> <img src='<?php echo base_url(); ?>images/login_icon.gif'/> What I am asking do i have to echo the base_url every time i want to add image or is there a better way to do that, Thanks.
[eluser]mdvaldosta[/eluser]
You don't have to use the base url, omitting it will just show the images from a relative path (which I prefer to do anyways).
[eluser]2mato[/eluser]
[quote author="mdvaldosta" date="1300738597"]You don't have to use the base url, omitting it will just show the images from a relative path (which I prefer to do anyways).[/quote] sorry but i did not understand how i can do that? My images are in a folder called images and on the same level is the application folder for CodeIgniter.
[eluser]2mato[/eluser]
[quote author="Atharva" date="1300802653"]You can use img function in html helper Code: $this->load->helper('html'); So you don't have to use base_url() each time. More info here[/quote] Thanks that work very good .... :-) |
Welcome Guest, Not a member yet? Register Sign In |