Without following your logic I can give an example of how style sheets
on PHPBeginner.com work:


In the page we have 
<link rel="stylesheet" href="/styles.php">

And in the styles.php we have all the possible DB connections, browser
checks by (PHP SNIFF) and so and so on.

You cold even try to call the class this way with Get: 
<link rel="stylesheet" href="/styles.php?foo=foo&bar=baz">

That will work as well.

But one thing you cannot do is defining variable on index.php hoping
they would become available in styles.php - those are TOTALY separated
processes. Something like if you would have a page with two frames.

So, here's another thing.
The only reason of using external CSS file is to have it automatically
cached by your browser so it loads once per session. By default it will
not. You're gonna need to review your headers, adding cache control to
it.

Hope it gave you an idea.

Maxim Maletsky
www.PHPBeginner.com



-----Original Message-----
From: Jason Dulberg [mailto:[EMAIL PROTECTED]] 
Sent: giovedì 4 ottobre 2001 6.19
To: [EMAIL PROTECTED]
Subject: [PHP] php in css not working with IF's


I have a common css file that is being used across several virtual
hosts. Basically, what I am trying to do is use the same css file even
though several text colors/sizes need to be changed depending on what
site/platform its being used on.

I have my sql query (retrieves $site_style) in the file that includes
the css file and a bunch of IF statements inside the css file itself.
The only problem is that the css is not being generated properly.

For some reason, the IF statements are not being processed correctly/at
all. I can echo the variables through the index.php and the variables
are set to global. Its just that styles.php seems to almost bypass the
IF and use the 1st set of variables even though it shouldn't be.

Here's an example from the css (styles.php) - there are about 5 IF
statements in there but here's the basic idea of them all:

<?php
//index.php creates platform and site style require("index.php");

if (($BROWSER_PLATFORM == "Win") && (($site_style!=="10") ||
($site_style!=="9"))) {
        $pc8=8;
        $pc9=9;
        $pc10=10;
        $pc12=12;
        $pc13=13;
        $pc14=14;
        $text="#ffffff";
        $heading="#2E4471";
}
?>

.standard {
    font-family:verdana, arial;
    font-size: <?=$pc10;?>pt;
    color:<?=$text;?>;
}

The call from site style 10
<link rel="stylesheet" href="/styles.php">

If I go to a $site_style 10, it still uses the variables defined within
the example IF statement even though it clearly shouldn't. If I type in
the URL to styles.php from a $site_style 10, it shows the wrong tags.

Is it a problem with my IF statements or is something else going over my
head?

Thanks again for any help - I've been trying to figure this out for days
to no avail...

__________________
Jason Dulberg
Extreme MTB
http://extreme.nas.net


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] To
contact the list administrators, e-mail: [EMAIL PROTECTED]



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to