• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
base_url() problems // designers are about to kill me :(

#1
[eluser]noland[/eluser]
Hello all;

There's one question I need to sort out, so any help will be well received.

In this case, I'm having troubles with the design department due to base_url().

I suppose I'm doing something bad, but I have to use everytime base_url() in order to use all the resources related to my views, for example:

Code:
<img src="&lt;?=base_url()?&gt;img/iconos/insertar_titulo.gif" name="Image8" border="0" align="absmiddle">

or

Code:
script src="&lt;?=base_url()?&gt;js/browserDetection.js" language="javascript">


because if I don't specify this base_url() the images simply doesn't load, the scripts don't work, and so on. Same with css, etc, which cause to the designers (and for me) a total destruction of the page layout.

Is there any workaround which permits to my dreamweaver reach correctly the route to the resources?

Thanks so much!

#2
[eluser]CI Auke[/eluser]
If you ask me you don't need to specify, have to use, the base_url()

#3
[eluser]Sarfaraz Momin[/eluser]
Hi,
I have not used base_url() for any entities on the page. They can be directly accessed using the / and having them in root folder. I don't see a reason to specify base_url().

#4
[eluser]Michael Wales[/eluser]
I personally create the following 3 folders at the root level: css, js, and images. I then reference those as such (note the starting slash in the URI):
Code:
<img src="/images/myimage.jpg" />

A lot of other people would rather create an assets folder at the root level, and then place the 3 folders named above within it.
Code:
<img src="/assets/images/myimage.jpg" />

Either way - referencing all of your assets, via a relative link from the root level, is the best option with CI.

#5
[eluser]lkagan[/eluser]
As long as you don't have to move the entire application to a subdirectory, you'll be fine with absolute references. I recently had to move my app to a subdirectory and was very glad that I used base_url(). I only had to change one line of code for all assets to correctly be references.

#6
[eluser]noland[/eluser]
first of all, thank you very much for your answers, and sorry for the delay greeting you them.

The problem was that I was working in a subdirectoy, so that's why my IDE couldn't get in touch with those resources.

I could 'see' the images, etc, simply switching the combo box "relative to" when linking to the resources between "document" and "site root". Now, it automatically adds as a prefix the subfolder inside the webroot, and it works!

Thanks very much once again for your advices Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.