amead@xxxxxxxxxxxx (Alan Mead) wrote: > My inclination is to create a large index.php file that examines the > user input and the current state and executes a subroutine that serves > the appropriate next page [...] This is exactly what my bt_ (bee-tee-undescore) framework does. Each page can be generated by its own function or static method. To put an anchor in the page, simply invoke the anchor() method: UserSession::anchor("Do this"", "MyForm::doThisAnchor", a, b, c); UserSession::anchor("Do that"", "MyForm::doThatAnchor", d, e); This code generates two anchors to be sent back to the client: <a href="index.php?i=1">Do this</a> <a href="index.php?i=2">Do that</a> Note the index "i=1": the actual function to invoke and its arguments are saved in the session of the user, so if the user clicks on a link, only a bare index "i=1" is sent back to the dispatcher page index.php; the dispatcher page recovers the user's session data, then recovers the index "i=1" from the request, and finally recovers the corresponding entry with the function to invoke: MyForm::doThisAnchor(a,b,c) Note that the user has no way to invoke arbitrary URLs with arbitrary parameters, because the only public URL of the whole web site is the dispatcher page index.php; the only allowed parameter is the index i=1 which is easy to parse and validate. For buttons: UserSession::button("Save", "MyForm::SaveButton", x, y, z); which works in exactly the same way as the anchors above. There are even more powerful concepts implemented: - A call stack among pages (you may go back to the "previous page") so that re-usable sub-pages can be created. From this feature originally came the name of the tool (Back Tracking) and the name of its functions (bt_*). - Multi-window sessions on a single browser. - User's session data storage, user's window session data storage, application data storage. - Bt_ Forms class to manage complex forms through call-back methods and a single renderer method. - Usual HTML controls implemented as classes, performing data formatting, state recovery from post-backs, parsing and validation. Plus, more advanced controls for file upload/download, panels (control of controls), Turing test. Tutorial: http://www.icosaedro.it/phplint/web/index.html Sample pages: http://www.icosaedro.it/bt (demo web site using bt and bt forms) https://www.icosaedro.it/iwa (an actual implementation serving my web site) All the code is part of the PHPLint package and its "standard library": http://www.icosaedro.it/phplint In particular the files and directories of interest could be: stdlib/it/icosaedro/web/Form.php (Sticky Form, a simple self contained form) stdlib/it/icosaedro/web/bt_/UserSession.php (bt_ main class) stdlib/it/icosaedro/web/bt_/Form.php (Bt_ Form) stdlib/it/icosaedro/controls (HTML controls for both Sticky Forms and Bt_ Forms) stdlib/com/acme/www (the sample web site above) stdlib/it/icosaedro/www (the iwa web site above) Hope this could be useful and give you some idea. Regards, ___ /_|_\ Umberto Salsi \/_\/ www.icosaedro.it