Welcome Guest, Not a member yet? Register   Sign In
css and image folder not working
#1

[eluser]vickatg[/eluser]
i am really new to codeigniter, i am currently facing a problem on how to load my css and images files. i have tried to read what others did in the ci forum but i stilled failed. please assist me where i might be going wrong.

my current directory structure is

/meeting
-system
-application
-css
-images
-javascript
-.htaccess
-index.php

my .htaccess file is as follows

RewriteEngine on
RewriteCond $1 !^(index\.php|javascript|css|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]

below is how i am loading my css

<link rel="stylesheet" href="<?php echo base_url();?>css/style.css" type="text/css" media="screen" />

in my view file.

i am also loading the url helper

yet My css/images is not loading. i ma frustrated help me out please
#2

[eluser]mdgrech[/eluser]
The problem comes in from where you are trying to load the resources, try this instead:

<link rel="stylesheet" type="text/css" href="<?php echo site_url('css/style.css'); ?>" />

Also here is my .htaccess file, it looks like it accomplished the same thing and is more concise. Not necessary but I thought I'd share :0

RewriteEngine on
RewriteCond $1 !^(index\.php|css|js|images|robots\.txt)
RewriteRule ^(.*)$ ./index.php/$1 [L]
#3

[eluser]NeoArc[/eluser]
You should load the url helper in order to use site_url() & base_utl()


<head>
<base href="<?php echo base_url()?>" />
<!-- clean urls-->
<link href="css/my.css" rel="stylesheet" media="screen" />
<link href="css/test.css" rel="stylesheet" media="screen" />
</head>
<body>
<div>
&lt;img src="images/something.jpg" alt="" title="" /&gt;
</div>
&lt;/body&gt;
#4

[eluser]vickatg[/eluser]
don't i need any other configurations for site_url() as i did for base_url() ? because it still doesn't work, my css is not loading any other procedure?
#5

[eluser]vickatg[/eluser]
@NeoArc @mdgrech i am following your procedures without any success.. any other informations that you need me to tell you? maybe you can understand where i am messing up things
#6

[eluser]vickatg[/eluser]
perhaps there is a problem with .htaccess? because when i view my url via source. they seem to be okey and yet css is not loading
#7

[eluser]NeoArc[/eluser]
You should install firebug.
There's an option (disabled by default) for inspecting all files loaded by the page.

Try this too:

RewriteEngine on
RewriteBase /meeting
RewriteCond $1 !^(index\.php|javascript|css|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L]


(Excuse my english!)
#8

[eluser]InsiteFX[/eluser]
Also your missing the semicolon!
Code:
&lt;base href="&lt;?php echo base_url();?&gt;" /&gt;

InsiteFX
#9

[eluser]toopay[/eluser]
[quote author="victor katemana" date="1302927981"]perhaps there is a problem with .htaccess? because when i view my url via source. they seem to be okey and yet css is not loading[/quote]
1. What is your base url config, and how you access your default controller. I mean, how your url looks like : is it like "http://localhost/ci_project_folder/" or "http://local.myproject.com"...

2. How you access your css, what the full url to access it...
#10

[eluser]NeoArc[/eluser]
I should have used the [c ode ][/c ode] blocks Sad

BTW PHP closing tags have an implicit end of command.




Theme © iAndrew 2016 - Forum software by © MyBB