View Full Version : As I code late at night

03-09-2007, 01:41 AM
Quick question can I use a php file as a link to a stylesheet such as

<link rel="stylesheet" href="user_style.php" />

Then the preprocessor would process a set of user variables into a css

03-09-2007, 01:54 AM
Yes, you can.

03-09-2007, 01:56 AM
thankyou :)

03-09-2007, 02:12 AM
Yes, you can.
Marvellous. I just learned something new. Wow, that opens a lot of possibilities...

03-09-2007, 02:33 AM
Im trying to create a class for ccs elements. somthing like

class style{
var $tag;
var $id;
var $class;
var $attributes=array();
var $parent;

Then when the user on my CMS sets the size of his template page to say 760px; then an instance will be created or something. Actually it had better check one doesnt exist already with same id or class or it will have to overite the exisiting instance.

03-09-2007, 02:36 AM
So was there a question or do you just like talking to yourself? ;p

03-09-2007, 02:47 AM
Request for comments. Let me investigate further and ill get back to you on that one

03-09-2007, 03:01 AM
Should stick this at the top of your php css file

header ('Content-Type: text /css');

03-09-2007, 05:15 PM
It's more efficient to have PHP generate a static CSS file (wasn't sure if you were going this way or not).

03-09-2007, 09:02 PM
It's more efficient to have PHP generate a static CSS file (wasn't sure if you were going this way or not).
If the css were static then you wouldn't need php at all. What do you mean by "more efficient"? As opposed to what?

03-09-2007, 09:23 PM

Whenever in the admin tool the administrator makes a change, instead of just saving to database/xml/file, you also generate a static CSS file.

This is much more efficient than having a PHP file act as a CSS file (where it has to generate the CSS for every request based on the database/xml/file), using header().

This is how some CMS systems work, instead of acting as a dynamic site, the admin tool will generate a static HTML file. It is much lighter on the server.

03-09-2007, 09:27 PM
Ok, I got the impression that he was just going to have the code in the file(without any database queries or anything) with an if/switch to select the right one for the current user. In which case the added load on the server is really negligible.

03-09-2007, 09:34 PM
I figured the intention was to make it dynamic, but otherwise the difference would be neglible, yes.

03-10-2007, 01:39 AM
What I inted is that the classes will directly resemble the css selectors that they represent that way when the user changes a value (for instance changes the page width to 800px) a class that has the info to point to the that attribute for css in question. That way I could make an engine that echoes the css at the end.