Welcome Guest, Not a member yet? Register   Sign In
dynamic css trough linking css as view
#1

[eluser]Unknown[/eluser]
hi everybody,

I have read many threads of the forum but i haven't read a possible answer for my problem.
I use firefox 3 and i'm developping with xampp 1.7
I use the addon firebug.
Please excuse my english, if some mistakes appear.

My problem:
I try to get the css file as result of a view, like it was proposed in several other threads (to be able to manipulate it).

like this:

<link rel="stylesheet" type="text/css" href="./dyn_css/basic/basic.css" />

Codeigniter calls the controller dyn_css and the function basic.
function basic:
$this->load->view('cssbasicdocument');

the file 'views/cssbasicdocument.php' contains a real stylecheet.

The file is loaded by firefox but is not used as stylecheet.
if i call the uri myself ../project/dyn_css/basic/basic.css, it is displayed correctly.
but firebug notifies: 'This stylecheet contains no rules' (translated)

If i use a direct uri, like href="./basic.css", where a real css-file is stored, the file is used correctly.
I noticed that if you dont use the ending .css even on a real css-file, firefox dont uses it as stylecheet.

So i used Httpfox (addon) to list the headers which are send on the different calls.
the difference was only the header 'Etag'.

Did i something wrong or is there a problem with xampp or codeigniter?
Did anybody have the same problem and got it solved?
#2

[eluser]GSV Sleeper Service[/eluser]
you may have to manually set the content type in the header, eg
Code:
header('Content-type: text/css');

[edit] may as well use the output class
Code:
$this->output->set_header("Content-type: text/css");
#3

[eluser]Unknown[/eluser]
Thank you for the fast answer.

Both ways are working.




Theme © iAndrew 2016 - Forum software by © MyBB