13. Other Tidbits
Single File QForms
<< Specifying a Template Filepath   |   Back to Main   |   Working with FormState Handlers >>

View Source
will open in a new window
Hello World, Revisited... Again... Again
We use the AJAX-enabled "Hello World" example to explain how you can make single file QForm pages. Note that this approach is not always recommended -- keeping the display logic (.php) file separate from the presentation HTML template (.tpl.php) file helps to enforce the good design and separation of display logic from the presentation layer (e.g. keeping the V and C separate in MVC).

However, there may be times when you want a simpler architecture of single-file forms, or you are making some very simple QForm pages and you do not want to deal with the overhead of the dual-file format. This example shows how you can use built-in PHP functionality to code your QForm as a single .php file.

Feel free to View Source (link in the upper-righthand corner) to see how this is done.

Click the button to change my message.