Welcome Guest, Not a member yet? Register   Sign In
base_url() in css and js
#1

[eluser]Felipe Deitos[/eluser]
Hi, i am having a hard time trying to discover what is the best way to build my css and js in the head of my document.

Its a local server, my base url in config.php is:
Code:
$config['base_url'] = 'http://localhost/orca/';

My htacess:
Code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /orca/index.php/$1 [L]

My css/js/images are in a root folder called assets.

In my .php file i tryed to put the css 3 ways.
Code:
// 1 - Work in all pages but i dont really want to show the entire url in the source code http://localhost/orca/assets/css/styles.css
<link rel="stylesheet" type="text/css" media="screen" charset="utf-8" href="<?php base_url(); ?>assets/css/styles.css" />


// 2 - This work in pages that i only call the controller ex: http://localhost/orca/home/, if i call http://localhost/orca/home/thing/ the css stop work
<link rel="stylesheet" type="text/css" media="screen" charset="utf-8" href="assets/css/styles.css" />


// 3 - This doest not work at all
<link rel="stylesheet" type="text/css" media="screen" charset="utf-8" href="/assets/css/styles.css" />

I really dont want to use the entire url.. someone know what i am doing wrong?


Messages In This Thread
base_url() in css and js - by El Forum - 08-13-2012, 05:45 AM
base_url() in css and js - by El Forum - 08-13-2012, 07:58 AM
base_url() in css and js - by El Forum - 08-13-2012, 08:09 AM
base_url() in css and js - by El Forum - 08-13-2012, 10:17 AM
base_url() in css and js - by El Forum - 08-13-2012, 05:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB