Training, Open Source computer languages

PerlPHPPythonMySQLhttpd / TomcatTclRubyJavaC and C++LinuxCSS

Search our site for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Server side scripting of styles to suit the browser
I'm updating our web site and, naturally, I want to use current standards for my HTML, and some of the newer features such as style sheets to make the web site cleaner and easier to navigate. But I was faced with a conflict - I want to be able to support customers who are browsing to our site with older browsers, AND I want to be able to make full use of style sheets and other newer facilities for those users with recent client software.

A first approach of attempting to come up with a set of style sheets to work with all our target browsers turned ino something of a complex exercise. It's pretty disheartening to spend a lot of time applying a fix to "kludge" one browser just to find that you've upset another. and the resulting file gets twice as hard to maintain each time a new set of browser support is added. Quite simply, it's not practical to come up with a single set of HTML and CSS that will well on all the older browsers AND will support the facilities of the newer ones that we wish to use

Our solution is to add PHP code into the style sheet ... and to tell the web server that .css files are to be parsed through the PHP module. It works a treat, and we set a header line to ensure the browser is told it's actually getting .css data. We can even pass parameters into the style sheet - in this example, to tell it to use a larger base font size to suit the accessability requirements of the disability discrimination act if need be.

<?php
header("content-type: text/css");
$mencolour = "#ffffcc";
$texcolour = "#000000";
$bfsize = 10;
if ($_REQUEST[fsize] == 1) $bfsize = 16;
?>

body {
font: normal <?= $bfsize ?>px verdana;
color: <?= $texcolour ?>;
}
(written 2005-09-12 14:54:33)

 
Associated topics are indexed under
A211 - Web Application Design and Deployment
H112 - PHP - Further Web Page and Network Handling

Back to
How far away is that server?
Previous and next
or
Horse's mouth home
Forward to
Database or Progamming - which to learn first?

Some other Articles
Tomorrow's meeting.
Up early
Sticky news
Database or Progamming - which to learn first?
Server side scripting of styles to suit the browser
How far away is that server?
Upgrade!
You cant
Fair system for travel and accommodation expenses
Outside of the box
1638 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

© WELL HOUSE CONSULTANTS LTD., 2008: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho