CodeIgniter Forums
CSS/images folder - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: CSS/images folder (/showthread.php?tid=4715)

Pages: 1 2


CSS/images folder - El Forum - 12-12-2007

[eluser]-spy-[/eluser]
im just a beginner using this framework, i have separate file and folder for CSS and images which i usually do, i put my HTML pages inside the views folder, together with the CSS file and images folder, which i think is not correct.. because whenever i run a page, its not able to load the images and CSS style..what should i do? hope you guys can help me...n_n


CSS/images folder - El Forum - 12-12-2007

[eluser]ejangi[/eluser]
I usually put my images, css and scripts folders in the same directory as the index.php file.


CSS/images folder - El Forum - 12-12-2007

[eluser]ELRafael[/eluser]
I put in the root folder.

Remmember, you will always call index.php. So is easier if put in the same level of index.php

My structure is like that

|system
|public
|- javascript
|- styles
|- images


CSS/images folder - El Forum - 12-12-2007

[eluser]-spy-[/eluser]
I've tried that, there's no problem with my index page, it loads the images and the CSS, but my other files in views folder.. were not able to do that.. i need your help badly..tnx


CSS/images folder - El Forum - 12-12-2007

[eluser]gtech[/eluser]
think we need a bit more info.. can we have a code example of how you are loading images and CSS in your view? I am guessing you are using relative paths so its may be best to put the full URL path when sourcing image/CSS files, if you are using the full url dont put the index.php bit in it. you can also use base_url() in your view.. e.g.
Code:
<img src="&lt;?=base_url()?&gt;system\application\views\images\image.jpg">
// base_url is retrieved from your config
// it may be set to somthing like  http:\\localhost\ci1.5.4\
assuming base_url is set correctly in your config.


CSS/images folder - El Forum - 12-12-2007

[eluser]-spy-[/eluser]
i have the same problem with this link

http://ellislab.com/forums/viewthread/66729/


CSS/images folder - El Forum - 12-12-2007

[eluser]-spy-[/eluser]
i made it... guys tnx for the help... n_n


CSS/images folder - El Forum - 12-25-2007

[eluser]Unknown[/eluser]
I don't know why, instead href="css/style.css" you must use href="/css/style.css", it works for me.


CSS/images folder - El Forum - 12-25-2007

[eluser]Phil Sturgeon[/eluser]
[quote author="AlexF" date="1198584415"]I don't know why, instead href="css/style.css" you must use href="/css/style.css", it works for me.[/quote]

The first example you have shown is a relative path. The second example is a root path. The / says "from the top please" just like in XPath.


CSS/images folder - El Forum - 12-30-2007

[eluser]theswede[/eluser]
[quote author="thepyromaniac" date="1198621894"][quote author="AlexF" date="1198584415"]I don't know why, instead href="css/style.css" you must use href="/css/style.css", it works for me.[/quote]

The first example you have shown is a relative path. The second example is a root path. The / says "from the top please" just like in XPath.[/quote]

Instead of having to use root-paths you can use the base-tag to set a base url for all links in a page.