#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    ksa
    Posts
    11
    Rep Power
    0

    calling a php file instead of css to specify stylesheet


    I wonder if this will work...
    the link is pointing to a php file which pulls out the style from the database instead of a regular css file...

    index.html
    Code:
    <html>
    <head>
    <link rel='stylesheet' href='css.php' type='text/css'>
    </head>
    <body>
    <!--html code here -->
    </body>
    </html>


    where css.php contains this
    Code:
    PHP Code:
    <?php 
    //check for cookies... 
    if isset($_COOKIES['style']) { 
     
    $style $_COOKIES['style']; 
     
    $css our_style($style); 

    else { 
    $css our_style('0'); } //your default style on the database 
    function our_style($style) { 
     include 
    "database_connection.php"// database connection script  
    $exec mysql_query("SELECT text FROM styles WHERE id='$style'"); 
     
    $output mysql_fetch_array($exec); 
     return (
    $output); 

    echo 
    $css
    ?>
    The database contains the styles... hmnnn...
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Windsor ON, Canada
    Posts
    462
    Rep Power
    13
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    36
    Rep Power
    11
    php is a beautiful thing

IMN logo majestic logo threadwatch logo seochat tools logo