CodeIgniter Forums
Weird behaviour - image dissappears - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Weird behaviour - image dissappears (/showthread.php?tid=9801)



Weird behaviour - image dissappears - El Forum - 07-09-2008

[eluser]The Mask[/eluser]
I have an 'About' page that is called by an 'About' controller...

function index()
{
$this->load->view( 'about_view' );
}

This works fine when called as: http://www.mysite.com/about

However, if I change my controller to include a method that does exactly the same, an image at the top of the page dissappears.

i.e.
http://www.mysite.com/about/test

and in my controller...
function test()
{
$this->load->view( 'about_view' );
}

So the same view is being loaded but an image is not shown. Any ideas, it's driving me nuts!
I have stripped everything out of the controller and view to leave basically what is above.


Weird behaviour - image dissappears - El Forum - 07-09-2008

[eluser]Bramme[/eluser]
what's the path of your image?

there's a huge difference between <img src="images/blah.gif"> or <img src="/images/blah.gif">

I'm guessing you've got smth like the first and you need smth like the second. (it happened to me on the current site i'm doing)


Weird behaviour - image dissappears - El Forum - 07-09-2008

[eluser]The Mask[/eluser]
All sorted.
Thanks very much!


Weird behaviour - image dissappears - El Forum - 07-09-2008

[eluser]extra_rice[/eluser]
[quote author="The Mask" date="1215630994"]All sorted.
Thanks very much![/quote]

so how did you solve it?


Weird behaviour - image dissappears - El Forum - 07-09-2008

[eluser]Dagobert Renouf[/eluser]
hi guys, I have a similar probleme here.

When I request my page with "index.php" image show up.
But if I just drop the index.php from the url they won't show up, wtf ?

The path is '../files/' and I tried a lot of different ones.
I'm trying to target : "www/codeIgniter/files"


Weird behaviour - image dissappears - El Forum - 07-09-2008

[eluser]The Mask[/eluser]
My image src was set to "images/xxx.jpg", changed it to "/images/xxx.jpg" and it works fine now. It was aa simple as that.


Weird behaviour - image dissappears - El Forum - 07-09-2008

[eluser]Dagobert Renouf[/eluser]
thank you themask :

To avoid the bug I need to do this : /codeigniter/images/xxx.jpg I don't know why this differs from you but whatever it works.