Re: Creating a Dynamic PHP/CSS Page (newbie design question)
| From: | Shawn McKenzie | Date: | Thu, 05 Nov 2009 20:13:36 +0000 |
| Subject: | Re: Creating a Dynamic PHP/CSS Page (newbie design question) | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-299663@lists.php.net to get a copy of this message | ||
cool@hosting4days.com wrote:
> SORRY FOR THE EXTRA 2 BAD pre SENDS (accident...)
>
>
> Thank for all the help!
>
> Getting there... as a baby step - I'm trying this:
>
> (part of this is from - http://sperling.com/examples/pcss/)
>
> 1 - I created this style sheet page called css.php with these contents:
>
> ================
>
> .test1 {
> font-family: Verdana, Arial, Helvetica, sans-serif;
> color: #0099FF;
> font-size: 18px;
> }
>
> <?php
> header("Content-type: text/css");
> $color = "green"; // <--- define the variable
> echo <<<CSS
> /* --- start of css --- */
> .title-text
> {
> color: $color; /* <--- use the variable */
> font-weight: bold;
> font-size: 1.2em;
> text-align: left;
> }
> /* --- end of css --- */
> CSS;
> ?>
>
> -------------------------
>
> 2 - I created this test page called testcss.php with these contents:
>
> PROBLEM: the 'test1' style shows up - but the 'title-text' doesn't
> seem
> to work
> btw: even added this : media="screen" from demo ....
> How do I get it to show up?
>
> ======
>
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
> <title>Untitled Document</title>
>
> <link href="css.php" rel="stylesheet" type="text/css"
> media="screen" />
> </head>
>
> <body >
> <p>test <span class="test1">this</span></p>
>
> <p class="title-text">and this</p>
> </body>
> </html>
>
>
> ===================
>
>
> Thanks,
> cool@hosting4days.com
You need to do the header() before anything else.
--
Thanks!
-Shawn
http://www.spidean.com