Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-09-2007, 12:41 AM   PM User | #1
timgolding
Senior Coder

 
timgolding's Avatar
 
Join Date: Aug 2006
Location: Southampton
Posts: 1,466
Thanks: 90
Thanked 110 Times in 109 Posts
timgolding is on a distinguished road
As I code late at night

Quick question can I use a php file as a link to a stylesheet such as
Code:
  <link rel="stylesheet" href="user_style.php" />
Then the preprocessor would process a set of user variables into a css
__________________
You can not say you know how to do something, until you can teach it to someone else.
timgolding is offline   Reply With Quote
Old 03-09-2007, 12:54 AM   PM User | #2
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,604
Thanks: 2
Thanked 399 Times in 392 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
Yes, you can.
Inigoesdr is offline   Reply With Quote
Old 03-09-2007, 12:56 AM   PM User | #3
timgolding
Senior Coder

 
timgolding's Avatar
 
Join Date: Aug 2006
Location: Southampton
Posts: 1,466
Thanks: 90
Thanked 110 Times in 109 Posts
timgolding is on a distinguished road
thankyou
__________________
You can not say you know how to do something, until you can teach it to someone else.
timgolding is offline   Reply With Quote
Old 03-09-2007, 01:12 AM   PM User | #4
phoenixshade
Regular Coder

 
Join Date: Feb 2007
Location: near Washington, DC
Posts: 135
Thanks: 0
Thanked 0 Times in 0 Posts
phoenixshade is on a distinguished road
Quote:
Originally Posted by Inigoesdr View Post
Yes, you can.
Marvellous. I just learned something new. Wow, that opens a lot of possibilities...
__________________
— Wilford Nusser
Validate Your Code: (X)HTML CSS
An HTML Email is NOT a Web Page: HTML Email Guide (1.2Mb pdf) Webmail CSS Support
REGEX: Brought to you by Psychotic Crack-Smoking Monkeys
phoenixshade is offline   Reply With Quote
Old 03-09-2007, 01:33 AM   PM User | #5
timgolding
Senior Coder

 
timgolding's Avatar
 
Join Date: Aug 2006
Location: Southampton
Posts: 1,466
Thanks: 90
Thanked 110 Times in 109 Posts
timgolding is on a distinguished road
Im trying to create a class for ccs elements. somthing like
PHP Code:
<?PHP
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.
__________________
You can not say you know how to do something, until you can teach it to someone else.

Last edited by timgolding; 03-10-2007 at 12:52 AM..
timgolding is offline   Reply With Quote
Old 03-09-2007, 01:36 AM   PM User | #6
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,604
Thanks: 2
Thanked 399 Times in 392 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
So was there a question or do you just like talking to yourself? ;p
Inigoesdr is offline   Reply With Quote
Old 03-09-2007, 01:47 AM   PM User | #7
timgolding
Senior Coder

 
timgolding's Avatar
 
Join Date: Aug 2006
Location: Southampton
Posts: 1,466
Thanks: 90
Thanked 110 Times in 109 Posts
timgolding is on a distinguished road
Request for comments. Let me investigate further and ill get back to you on that one
__________________
You can not say you know how to do something, until you can teach it to someone else.
timgolding is offline   Reply With Quote
Old 03-09-2007, 02:01 AM   PM User | #8
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Should stick this at the top of your php css file

header ('Content-Type: text /css');
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 03-09-2007, 04:15 PM   PM User | #9
aedrin
Senior Coder

 
Join Date: Jan 2007
Posts: 1,648
Thanks: 1
Thanked 58 Times in 54 Posts
aedrin will become famous soon enough
It's more efficient to have PHP generate a static CSS file (wasn't sure if you were going this way or not).
aedrin is offline   Reply With Quote
Old 03-09-2007, 08:02 PM   PM User | #10
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,604
Thanks: 2
Thanked 399 Times in 392 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
Quote:
Originally Posted by aedrin View Post
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?
Inigoesdr is offline   Reply With Quote
Old 03-09-2007, 08:23 PM   PM User | #11
aedrin
Senior Coder

 
Join Date: Jan 2007
Posts: 1,648
Thanks: 1
Thanked 58 Times in 54 Posts
aedrin will become famous soon enough
Simple.

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.
aedrin is offline   Reply With Quote
Old 03-09-2007, 08:27 PM   PM User | #12
Inigoesdr
Super Moderator


 
Inigoesdr's Avatar
 
Join Date: Mar 2007
Location: Florida, USA
Posts: 3,604
Thanks: 2
Thanked 399 Times in 392 Posts
Inigoesdr is a jewel in the roughInigoesdr is a jewel in the roughInigoesdr is a jewel in the rough
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.
Inigoesdr is offline   Reply With Quote
Old 03-09-2007, 08:34 PM   PM User | #13
aedrin
Senior Coder

 
Join Date: Jan 2007
Posts: 1,648
Thanks: 1
Thanked 58 Times in 54 Posts
aedrin will become famous soon enough
I figured the intention was to make it dynamic, but otherwise the difference would be neglible, yes.
aedrin is offline   Reply With Quote
Old 03-10-2007, 12:39 AM   PM User | #14
timgolding
Senior Coder

 
timgolding's Avatar
 
Join Date: Aug 2006
Location: Southampton
Posts: 1,466
Thanks: 90
Thanked 110 Times in 109 Posts
timgolding is on a distinguished road
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.
__________________
You can not say you know how to do something, until you can teach it to someone else.
timgolding is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:33 PM.


Advertisement
Log in to turn off these ads.