Welcome Guest, Not a member yet? Register   Sign In
base_url() problems // designers are about to kill me :(

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:

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


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!

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

[eluser]Sarfaraz Momin[/eluser]
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().

[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):
<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.
<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.

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.

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

Theme © iAndrew 2016 - Forum software by © MyBB