Reply to Re: [newbie] how to style form with css?

Your name:

Reply:


Posted by JackM on 01/23/06 19:32

Jerry Stuckle wrote:
> JackM wrote:
>
>> 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
>> }
>>
>> ?>
>
>
> Including css instead of linking to it, among other things, increases
> the traffic.
>
> When a css file is linked in, most browsers will cache the css. When
> the css is used with multiple pages, the browser doesn't request a new
> copy of the file - it just uses the cached version.
>
> When you include the css in a page, the css will not be cached and will
> be sent with every copy of the page, increasing traffic, server load and
> response time to the user.
>
> Unnecessarily including files instead of linking to them is not
> considered a good programming technique.

Increase in server resources is minimal at best. Script that my css
resides in has to be called for every page to determine browser anyway
so any additional hit that the css causes is infinitesimal.

You say "po-tay-to" and I say "po-tah-to". ;)

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация