CSS, JS, IMG...? |
[eluser]agartzia[/eluser]
[quote author="ekeretex" date="1201015503"]How is your directory structure organized? Is the assets folder at the same level as your index.php file?[/quote] I've changed a couple of times, but for now it's... Code: + assets
[eluser]ekeretex[/eluser]
With your structure if http://localhost shows your home page, http://localhost/assets/img/blah.jpg should show your blah.jpg image. Does that work?
[eluser]agartzia[/eluser]
[quote author="ekeretex" date="1201017673"]With your structure if http://localhost shows your home page, http://localhost/assets/img/blah.jpg should show your blah.jpg image. Does that work?[/quote] Yes, well, I can access this URL http://172.26.0.99/project_ci/assets/css/style.css In my view: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> How I can use relative paths?
[eluser]ekeretex[/eluser]
With your current setup, make the ccs path '/project_ci/assets/css/style.css'. The starting slash is important to make it absolute. Alternatively, set the base path to 'http://172.26.0.99/project_ci/' and use either '/assets/css/style.css' or '<?php echo base_url(); ?>assets/css/style.css'
[eluser]ekeretex[/eluser]
Update: even if you set the base path you still need to use ‘/project_ci/assets/css/style.css’ unless you include the base_url() function call
[eluser]Craig A Rodway[/eluser]
This is how I do it: I make a www folder in the same directory as system, index.php etc... Code: + system In your template/layout, you can use the <base> tag like this (in the <head> section): Code: <base href="<?php echo $this->config->item('base_url') ?>www/" /> To load CSS: Code: <link rel="stylesheet" type="text/css" href="css/screen.css" media="screen,projection" title="Screen layout" /> Images: Code: <img src="img/header.jpg" />
[eluser]agartzia[/eluser]
Solved! I've tried the complete path (/project_ci/assets/css/style.css) AND, here it goes the interesting part, removing the .htaccess content: Code: RewriteEngine on With full path and with no .htaccess, it worked! Anyway, I can't point out base_url to http://172.26.0.99/project_ci/ because it must be accessed outside as well (example.com/project_ci) Can I hide the index.php in any other way? The one in the guide doesn't work for me. I've taken a sight to the httpd.conf and it seems to be correct (AllowOverride All?) With such a great community, it's a pleasure to code.
[eluser]Craig A Rodway[/eluser]
@agartzia: Try that htaccess again but with the 'assets' folder included in the condition: Code: RewriteEngine on
[eluser]agartzia[/eluser]
[quote author="Craig Rodway" date="1201019030"]@agartzia: Try that htaccess again but with the 'assets' folder included in the condition: Code: RewriteEngine on Nop, it does not work. But, anyway, the application doesn't work without the index.php either. I can live on without removing the index.php from the URI, while I'm able to use css. Cheers! |
Welcome Guest, Not a member yet? Register Sign In |