Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts

    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.

  • #2
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    Yes, you can.

  • #3
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    thankyou
    You can not say you know how to do something, until you can teach it to someone else.

  • #4
    Regular Coder
    Join Date
    Feb 2007
    Location
    near Washington, DC
    Posts
    135
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #5
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    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.
    Last edited by timgolding; 03-10-2007 at 12:52 AM.
    You can not say you know how to do something, until you can teach it to someone else.

  • #6
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    So was there a question or do you just like talking to yourself? ;p

  • #7
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    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.

  • #8
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Should stick this at the top of your php css file

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

  • #9
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    It's more efficient to have PHP generate a static CSS file (wasn't sure if you were going this way or not).

  • #10
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    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?

  • #11
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    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.

  • #12
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,642
    Thanks
    2
    Thanked 405 Times in 397 Posts
    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.

  • #13
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    I figured the intention was to make it dynamic, but otherwise the difference would be neglible, yes.

  • #14
    Senior Coder timgolding's Avatar
    Join Date
    Aug 2006
    Location
    Southampton
    Posts
    1,519
    Thanks
    114
    Thanked 110 Times in 109 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •