|
Posted by JackM on 01/23/06 18:05
Jerry Stuckle wrote:
> JackM wrote:
>
>>
>> Use a php include:
>>
>> include( $_SERVER['DOCUMENT_ROOT'] . "/cssfile.css" );
>>
>> or you may need something like
>>
>> include("/var/www/public_html/yoursite/cssfile.css");
>>
>> Of course, you need to aim the path to fit your server's needs. If you
>> need more information, try Googling "php include css file"
>>
>>
>>
>
> You don't include CSS files. You link to them.
No, mine are included in a file called sitecss.css along with a browser
sniffer and called with a function. May not be your way but it works
just fine. The function:
<?php
//note that this is NOT the complete script pasted here, just the function
function css_site() {
//determine font for this platform
if (browser_is_windows() && browser_is_ie()) {
//ie needs smaller fonts than anyone else
$font_xlarge='large';
$font_large='medium';
$font_medium='small';
$font_size='x-small';
$font_smaller='xx-small';
$font_smallest='7pt';
} else if (browser_is_windows()) {
//netscape or "other" on wintel
$font_xlarge='x-large';
$font_large='large';
$font_medium='medium';
$font_size='small';
$font_smaller='x-small';
$font_smallest='x-small';
} else if (browser_is_mac()){
//mac users need bigger fonts
$font_xlarge='xx-large';
$font_large='x-large';
$font_medium='large';
$font_size='medium';
$font_smaller='small';
$font_smallest='x-small';
} else {
//linux and other users
$font_xlarge='x-large';
$font_large='large';
$font_medium='medium';
$font_size='small';
$font_smaller='x-small';
$font_smallest='x-small';
}
$site_fonts='arial, helvetica, sans-serif';
?>
<STYLE TYPE="text/css">
<!--
..size1 { font-family:<?php echo $site_fonts; ?>; font-size: <?php echo
$font_smaller; ?>; font-weight: normal;}
..size2 { font-family:<?php echo $site_fonts; ?>; font-size: <?php echo
$font_size; ?>; font-weight: normal;}
..size3 { font-family:<?php echo $site_fonts; ?>; font-size: <?php echo
$font_medium; ?>; font-weight: normal;}
..size4 { font-family:<?php echo $site_fonts; ?>; font-size: 1.4em;
font-weight: normal;}
..size5 {font-family:<?php echo $site_fonts; ?>;font-size:<?php echo
$font_xlarge; ?>;font-style:normal;font-weight:normal;}
..size1b { font-family:<?php echo $site_fonts; ?>; font-size: <?php echo
$font_smaller; ?>; font-weight: bold;}
..size2b { font-family:<?php echo $site_fonts; ?>; font-size: <?php echo
$font_size; ?>; font-weight: bold;}
..size3b { font-family:<?php echo $site_fonts; ?>; font-size: <?php echo
$font_medium; ?>; font-weight: bold;}
..size4b { font-family:<?php echo $site_fonts; ?>; font-size: 1.4em;
font-weight: 900;}
..size5b {font-family:<?php echo $site_fonts; ?>;font-size:<?php echo
$font_xlarge; ?>;font-style:normal;font-weight:bold;}
-->
</STYLE>
<?php
}
?>
[Back to original message]
|