Results 1 to 2 of 2

Thread: Dynamic CSS problem

  1. #1
    Join Date
    Oct 2006
    Posts
    1

    Dynamic CSS problem

    I have a site by where i want to pass a different variable into a css file depending upon the page.
    Currently i am using:-


    Code:
    <? 
    $pgcolor="#000000"; 
    ?> 
    <link href="style.php?pgcolor=<? echo $pgcolor;?>" type="text/css" rel="stylesheet">
    and then within the css file style.php am using:-

    Code:
    <?php 
    header("Content-type: text/css"); 
    $pgcol= $_GET['pgcolor']; 
    ?> 
    body { color:<?=$pgcol?>; } 
    <? 
    ?>
    This isnt working for me.. Is there a way of doing it?

    Thanks

  2. #2
    Join Date
    Oct 2006
    Posts
    26
    Have you done much PHP before and ever had any problems?

    I would try changing all of the <? bits of code to <?php firstly ( i had a problem with this once)

    and change
    color:<?=$pgcol?>;
    to:
    color:<?php echo $pgcol; ?>

Similar Threads

  1. Problem with Flash on CSS
    By NahiaN in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 10 Sep 2006, 05:14 AM
  2. slight problem with CSS code
    By webguy_dave in forum General Questions
    Replies: 1
    Last Post: 17 Dec 2005, 02:55 PM

Posting Permissions

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