There are many elements to your on line application - there's the "look" (1), the "feel" (2), the algorithms behind it (3), and the way the whole thing is bolted together (4).
1. The look
may be shared across all the pages of your web site.
2. The feel
you choose to use may be shared across all your online applications, perhaps numerous web sites, but not be applicable to "flat" pages.
3. The algorithms
are likely to be shared by a selection of applications, some of which may run in a batch (crontab) type environment that don't share the look and feel.
4. The controlling logic
that ties the whole application together will be unique, but will aways be based on the following steps as it moves from one page to the next:
• read in any "session" or "shopping cart" information
• read and validate form fields from the form JUST COMPLETED and in the process work out which page is to be displayed next
• perform any general calculation and logging tasks needed for each page processed
• prepare for the next page / form that's to be displayed
• save away and shopping cart / session data that's to be retained
• send out the next page.
A couple of years ago, I had the pleasure of spending a little time listening to Rasmus Lerdorf - the author of PHP - as he gave an advanced tutorial session; he was talking of a similar 4 layer model to my description at the beginning of this piece, and I have used similar for numerous applications since - indeed I have my own standard "feel" file that's used pretty much all over the place. It's wonderful in that I can employ techniques such as sticky fields, and do all my handling of characters such as &, <, ", ' and > in a single place which has been fully tested and should be fairly bullet proof.
I awoke early on Christmas morn. Perhaps you did too? The sound of reindeer in the distance as Santa rode past from one good child's house to the next? No - it was the rain against the window and a feeling that I really ought to provide a good, updated example of the four layer model. And I got the inspiration!
The Top Layer
- in which the whole is tied together - is a PHP file in which you can see all the steps laid down can be seen (source code) here
. This is element "4" in my description.
The Business Logic
- also in PHP contains the meat of the calculations and application-specific validation. In a demonstration, there's very little to this, but you can see the code here
- element 3 in my description.
The Web Helpers
- again in PHP - are the functions that provide form support, sticky fields, secure handling of nasty characters - element 2 in my description and available for my demonstration here
in source code.
The Feel of the page
I have that code running on our web site - link here - so that you can see how it works
But this code is - just
a demonstration; the power comes in the re-use of the formula. Come the 26th, I was testing a new incident book system
Associated topics are indexed underG996 - Well House Consultants - Newsletter Scripts 
Oops - I typed ci not vi, and have lost my file ... - (2011-02-21) 
Changing Images - (2009-12-17) 
Controlling, supressing, enabling PHP error messages - (2009-10-02) 
Error Handling in Lua with assert and pcall - (2009-08-13) 
Grouping rows for a summary report - MySQL and PHP - (2009-06-27) 
Using the internet to remotely check for power failure at home (PHP) - (2009-04-29) 
Finding variations on a surname - (2009-02-17) 
mod_rewrite for newcomers - (2008-12-20) 
Ajax - going Asyncronous and what it means - (2008-09-28) 
First class functions in Lua lead to powerful OO facilities - (2008-08-07) 
Factory method example - Perl - (2008-06-04) 
Replacing the last comma with an and - (2008-04-04) 
Script to present commonly used images - PHP - (2008-01-13) 
Error logging to file not browser in PHP - (2007-10-11) 
Resetting session based tests in PHP - (2007-08-26) 
What are factory and singleton classes? - (2007-06-04) 
mysqldump and mysqlrestore - (2007-03-30) 
Final, Finally and Finalize - three special words in Java - (2007-02-05) 
.pdf files - upload via PHP, store in MySQL, retrieve - (2006-12-19)H115 - Designing PHP-Based Solutions: Best Practice 
Even early on, separate out your program from your HTML! - (2013-04-25) 
Filtering PHP form inputs - three ways, but which should you use? - (2012-11-18) 
PHP sessions - a best practice teaching example - (2012-07-27) 
Separating program and artwork in PHP - easier maintainance, and better for the user - (2011-12-05) 
How to build a test harness into your PHP - (2010-03-16) 
Not just a PHP program - a good web application - (2009-09-29) 
Adding a newsfeed for your users to a multipage PHP application - (2009-06-06) 
Improving the structure of your early PHP programs - (2009-05-25) 
Refactoring - a PHP demo becomes a production page - (2008-09-12) 
Defensive coding techniques in PHP? - (2008-07-02) 
PHP Techniques - a workshop - (2008-04-26) 
Short and sweet and sticky - PHP form input - (2008-02-06) 
Software to record day to day events and keep an action list - (2007-12-31) 
A story about benchmarking PHP - (2007-12-23) 
Ordnance Survey Grid Reference to Latitude / Longitude - (2007-10-14) 
Converting from postal address to latitude / longitude - (2007-10-13) 
Controlling and labelling Google maps via PHP - (2007-10-13) 
Using a MySQL database to control mod_rewrite via PHP - (2007-10-06) 
Easy handling of errors in PHP - (2007-08-27) 
Drawing hands on a clock face - PHP - (2007-05-19) 
Painting a masterpiece in PHP - (2007-05-10) 
Good Programming practise - where to initialise variables - (2007-05-09) 
Back button - ensuring order are not submitted twice (PHP) - (2007-04-28) 
Learning to write secure, maintainable PHP - (2007-01-25) 
Maintainable code - some positive advice - (2007-01-21) 
Code quality counts - (2006-11-26) 
Global, Superglobal, Session variables - scope and persistance in PHP - (2006-11-21) 
PHP - good coding practise and sticky radio buttons - (2006-10-17) 
Reporting on the 10 largest files or 10 top scores - (2006-08-20) 
Giving the researcher power over database analysis - (2006-01-22) 
Merging pictures using PHP and GD - (2006-01-13) 
Robust checking of data entered by users - (2005-08-27) 
A year on - should we offer certified PHP courses - (2005-07-28) 
Code and code maintainance efficiency - (2005-06-08) 
Putting a form online - (2005-03-29) 
Crossfertilisation, PHP to Python - (2005-03-06) 
Short underground journeys and a PHP book - (2004-11-19)H116 - Shopping Cart Application in PHP 
Kiss and Book - (2008-05-07)
Some other Articles
Apple Mac Operating System OS X - code names and version numbersPictures of DecemberNew trainee laptop fleet for our Open Source coursesEfficient PHP applications - framework and exampleDoes anyone understand Lithuanian?Copyright and theft of images, bandwidth and members.A christmas messageWhat have hotels and bananas got in common?