How can I pass variables across a dynamic CSS file?

Discussion in 'PHP' started by EnPassant, Sep 27, 2008.

  1. #1
    Hi guys,

    I have been struggling to find a method but I could not know how to resolve this odd problem.

    Problem is:
    I would like to pass a variable; say $basefont to a dynamic CSS which is made by php like this:

    
    <?php
    header("Content-type: text/css");
    ?>
    
    HTML:
    I know I can do this:

    
    $basefont = 'Arial';
    
    HTML:
    Then use it in the same style.php file, but I want the variables to be called from other files. However, I can't use the include() or require() at the same time.. I tried to set global variables and everything, didnt work.. what I am missing :(

    Thanks in advance
     
    EnPassant, Sep 27, 2008 IP
  2. themole

    themole Peon

    Messages:
    82
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Add session_start() to your main file and to your style.php:

    $_SESSION['basefont'] = 'Arial';
     
    themole, Sep 27, 2008 IP
  3. EnPassant

    EnPassant Active Member

    Messages:
    612
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    70
    #3
    Ok I will try sessions, thanks for the idea.. :)
     
    EnPassant, Sep 28, 2008 IP