Welcome Guest, Not a member yet? Register   Sign In
Problem in loading images in my web page
#1

[eluser]oldrock[/eluser]
Hi..,

i m just to starting to program my site using code igniter. i have done the following steps

1. created the index page code in the views folder.
2. i loaded the index page from the controller with the code $this->load->view('index');
3. i got the index page displayed in the browser but the images i have included in my code from the images folder is not getting displayed.

help me please with your solutions, it would be greatful for me
#2

[eluser]cchi[/eluser]
echo the base_url() then point to the folder wer ur images are place..
#3

[eluser]Met[/eluser]
or add

<base href="<?php echo site_url();?>" />

then you can use relative links to your media, i.e
using this "base" href,

<img src="assets/images/foo.jpg" />

is the same as

<img src="http://www.mysite.com/assets/images/foo.jpg" />

but much more portable
#4

[eluser]oldrock[/eluser]
Thanks for your reply

can u please let me know in which file i have to add those settings.

i got following error while using the img function

Fatal error: Call to undefined function img() in /opt/lampp/htdocs/gowtham1/CodeIgniter_1.7.2/system/application/views/test4.php on line 6


Thanks in advance
#5

[eluser]Met[/eluser]
the &lt;base href /&gt; code goes in your views - inbetween html "&lt;head&gt;&lt;/head>" tags.

you also have to load the HTML helper to use img -

$this->load->helper('html');

in your controller.
#6

[eluser]cchi[/eluser]
$autoload['helper'] = array('url'); >>enable this to you autoload page..
#7

[eluser]portgaz[/eluser]
maybe it has something to do with your .htaccess file..

just add the the name of the image folder.

:lol: hope it helps!




Theme © iAndrew 2016 - Forum software by © MyBB