Welcome Guest, Not a member yet? Register   Sign In
codeigniter doesn't allow you to use relative paths for css and javascript loading?
#1

[eluser]johnmerlino[/eluser]
Hey all,

I tried this for hours and I am 100 percent that it was pointing at the right directory:

Code:
<link rel="stylesheet" type="text/css" href="../public/stylesheets/application.css" />
//this is in template.php which is in views which is at the same level as public, so I go up a directory, go to public, find stylesheets, and then load application.css. This should work but doesn't.

Then finally I tried this and it worked:
Code:
<link rel="stylesheet" href="<?php echo base_url();?>system/application/public/stylesheets/application.css" type="text/css" media="screen"/>

The issue maybe that I am not even clear as to what file the server has been requested.

Basically, when the user goes to the home page, for example, it triggers the show method of the categories class (which is itself a 'controller' in mvc). That show method populates show.php in categories directroy with data depending on what posts have been associated with the category 'home'. Then that show.php results gets put into template.php, which contains the header info and this gets called:

Code:
return $this->CI->load->view($template, $this->template_data, $return);

$template refers to template.php and template data is the data from show.php. This load->view is called within a library called Template.php

So I am not even clear myself what actual file the server is requesting since a lot of files are being requested.

Thanks for response.
#2

[eluser]InsiteFX[/eluser]
In your head tags!
Code:
<base href="<?php echo base_url();?>">

InsiteFX
#3

[eluser]johnmerlino[/eluser]
thanks for response




Theme © iAndrew 2016 - Forum software by © MyBB