Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
For 2023 - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
Setting your colour theme through PHP

Although we usually think of PHP as a server side language concerned with databases and the driving of applications, it's also of great use in controlling the use's look and feel ... indeed, I've just written a number of examples of how PHP can be used to select a set of colours (themes) for the user. Here's the sort of code that you might find in the PHP page.

<?php if ($_REQUEST[colset] == 1) { ?>
body {color: navy; background: olive;}
.person {}
.toptit {font-size: 140%; color: purple;}
.total {color: maroon;}
<?php } else { ?>
body {color: yellow; background: black;}
.person {}
.toptit {font-size: 120%; color: aqua;}
.total {color: green;}
<?php } ?>

The use of a themed approach rather than providing controls over individual attributes means that the page provider can select appropriate combinations and allow the user to quickly and easily switch between the - the opposite alternative of providing controls on a per-attribute basis may give far greater flexibility, but it also gives rise to a system that it's longwinded for the user to change, and a system in which the user can, potentilly, hit on a totally inappropriate combination.

See - source code and code demonstration

Our new course module also includes a step by step guide to generating separate style sheets through PHP - ideal for a shared-style web site, and vital if you're concerned with flexible coding to meet the UK's DDA (Disability Discrimination Act)

Update - I've added a complete example into the new course module that combines PHP, style themes, cookies and a pulldown menu to change the themes. See here for the source code and here to run the code
(written 2006-12-17, updated 2006-12-21)

Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
W704 - Web and Intranet - Cascading style sheets - putting it all together
  [501] .css - using PHP to make dynamic style sheets - (2005-11-21)
  [565] Using PHP to output images, XML, Style sheets, etc - (2006-01-15)
  [994] Training on Cascading Style Sheets - (2006-12-17)
  [1677] CSS training - Cascading Style Sheets (UK course) - (2008-06-15)
  [2223] CSS Style Diagrams - working out where attributes come from - (2009-06-08)
  [4037] Cascading Style Sheets and formatting your web page - (2013-03-10)

H118 - Generating CSS through PHP

Back to
Ruby's case - no break
Previous and next
Horse's mouth home
Forward to
Most recent file in a directory - PHP
Some other Articles
One Thousand Posts and still going strong
Cascading and the buses
The year of the exploding projector
Most recent file in a directory - PHP
Setting your colour theme through PHP
Ruby's case - no break
Positioning with Cascading Style Sheets
Enthusiastic, but ....
Adding a member to a Hash in Ruby
4759 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, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 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).

You can Add a comment or ranking to this page

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

PAGE: http://www.wellho.net/mouth/996_Sett ... h-PHP.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb