Python, Lua and Tcl - public course schedule [here] Private courses on your site - see [here] Please ask about maintenance training for Perl, PHP, Java, C, C++, Ruby, MySQL and Linux / Tomcat systems |
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 H118 - Generating CSS through PHP [565] Using PHP to output images, XML, Style sheets, etc - (2006-01-15) [501] .css - using PHP to make dynamic style sheets - (2005-11-21) W704 - Web and Intranet - Cascading style sheets - putting it all together [4037] Cascading Style Sheets and formatting your web page - (2013-03-10) [2223] CSS Style Diagrams - working out where attributes come from - (2009-06-08) [1677] CSS training - Cascading Style Sheets (UK course) - (2008-06-15) [994] Training on Cascading Style Sheets - (2006-12-17)
Some other Articles
One Thousand Posts and still going strongCascading and the busesThe year of the exploding projectorMost recent file in a directory - PHPSetting your colour theme through PHPRuby's case - no breakPositioning with Cascading Style SheetsEnthusiastic, 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).
|
|