Welcome Guest, Not a member yet? Register   Sign In
problem with loading css when calling controllers method
#1

[eluser]Unknown[/eluser]
First of all I want to wish Happy New Year to all of you, I am new here, I started to learn CI for past months, I've watched a lot of tutorials, read FAQ and etc.

I have a website that I programmed in procedural way so now I want to change that to CI and I've encountered some problem with loading views, precisely css.

My template organization is something like this :

I have a template file in my views folder which contains :

<?php $this->load->view('includes/header'); ?>

<?php $this->load->view($main_content); ?>

<?php $this->load->view('includes/menu'); ?>

<?php $this->load->view('includes/footer'); ?>

And regarding to this all I do later in my Controller function is :

$data['main_content']='home';
$this->load->view('includes/template',$data);

The problem is next:

When I go to this url : localhost/ci_site/home it loads ok , css and everything else but when I type this url: localhost/ci_site/home/index my css is not loading, I opened source code of that page and all parts of template are loaded but css is not?

I have Home controller and index function which loads that view in the way described earlier and as I know when you call controller by it's name it load's by default the index function but and in that case css is working but when I add the name of that function in this case index, css is not loading, I don't see difference here and yet it's not working.

The path to the css is loading in that header part of my template, and the href is set to css/style.css and that folder is on the same level as my application.

In the tutorials I watched they did it the same way and it works for them and I cant tell the difference here.

I've noticed only one differnce in that tutorial and that is the path to that css file,
they do it like this: <link rel="stylesheet" href="<?php echo base_url();?>/css/style.css" type="text/css" media="screen" />

with printing the base_url but i tried that way as well and in that case i dont get my css loaded in any way at all.

I'm really confused here, I know that this is probably the stupid problem but because I am starter I hope that someone of you seniors already knows what the problem is.

Thank you in advance !




Theme © iAndrew 2016 - Forum software by © MyBB