Welcome Guest, Not a member yet? Register   Sign In
Relative Path Problems
#1

[eluser]Unknown[/eluser]
I'm working on my first CodeIgniter project and I'm having a few issues with relative paths. I'm hoping someone can help point me in the right direction as I'm sure I'm missing something simple. While app development has been quick, I've REALLY struggled with supposedly easy stuff like paths.

Setup
My CodeIgniter App is a subfolder of a larger site. The larger site has header and footer files which I'd like to reuse. I am struggling to get the images to pull in with the correct path. If I use the main header file, CodeIgniter adjusts my relative paths to the in the header file to try and find them inside of the CodeIgniter File.

So my header file will load (using 'include') but the images won't. The header file images sitting on the main site look like this.

Code:
<IMG SRC="images/spacer.gif" WIDTH="18" HEIGHT="1" ALT="">

So if I type in http://www.mysite.com/images/spacer.gif, the file shows up.

However, when I call the include outside of my CodeIgniter folder, it tries to find the image files here: http;//www.mysite.com/MyCIApp/Controller/images/spacer.gif

I'm looking for advice on how to proceed next. There has to be a very easy way around this but I've tried alot of stuff and the only way I can get it working right now is to have add an additional images folder (inside my CI Folder) and 2 more header files.

Any guidance would be appreciated. Thanks.
#2

[eluser]dudeami0[/eluser]
Code:
<IMG SRC="/images/spacer.gif" WIDTH="18" HEIGHT="1" ALT="">

Would that work?
#3

[eluser]Unknown[/eluser]
:red: Yes it would. Thank you!




Theme © iAndrew 2016 - Forum software by © MyBB