| What is Waf | ||
|
||
|
The HTS Web Application Framework is a PHP and Javascript based framework designed to make simple web applications easy to design and implement. The framework implements a custom tag engine with an automated Javascript and/or PHP Event Model and automates the transfer of data to and from the server. The framework is in an early alpha state but is usable for this demonstration. Demonstration
It's easiest to demonstrate with a bit of sample code. Here is a simple application that looks at the selected state and presents a list of cities to choose. When the user selects a state and city the selected city's population is displayed. First the HTML cc_citystate.html
<head>
"state" is populated with 2 state abbreviations (MA and NY). An event handler for "onchange" is assigned. The handler will be passed the current value of state when it is called. "city" is empty and
disabled and has its own "onchange" handler that will
receive the values of "state" and "city". Event Handlers Javascript Our first event handler is for "state:onchange" and its handler will be implemented in Javascript. The handler will examine the value of "state" and populate the "city" list. cc_citystate.class.js
function cc_citystate(){ }PHP cc_citystate.class.php
<?phpFor this simple demonstration either event handler could have been implemented in Javascript or PHP. In more complex examples careful thought must be given. Most simple things should be handled using Javascript for performance. PHP would be used when, for example, data must be pulled from a database; or when business logic or other IP must be hidden. Pulling it all together The three files (cc_citystate.class.php, cc_citystate.class.js and cc_citystate.html) are all that is required to run the application. The url "http://someserver.tld/app_runner.php?app=citystate" is loaded in the browser to start the application. Additional Info
Conclusion This project is evolving quickly. I truly believe this can be a powerful tool for creating robust and useful web applications. Since it is implemented as a tag engine pages come together quickly. Applications can be prototyped quickly using PHP for all event handlers. Having all your event handlers coded in PHP eliminates the need for cross-browser testing in the early stages of development. Once the application is feature complete, the event handlers can be moved to Javascript for performance. I welcome any feedback. |
|
| © 2006 Bert Rosell | ||