13. Other Tidbits
Specifying a Template Filepath
<< Attribute Overriding
|
Back to Main
|
Single File QForms >>
View Source
will open in a new window
Hello World, Revisited... Again...
By default, the
QForm
engine will insert
.tpl
to the PHP script's file path to use as the template file path. For example, for the very first example, the script with the form defintion was named
intro.php
. Therefore, by default, QCubed used
intro.tpl.php
as the HTML template include file (the "tpl" signifying that it's an HTML template).
For many reasons you may want to use a different filename or even specify a different filepath altogether. In fact, the QCubed Code Generator does this when it generates the form_draft template files into a separate directory than the form_drafts, themselves.
The
QForm::Run
method takes in an optional second parameter where you can specify the exact filepath of the template file you wish to use, overriding the default "script_name.tpl.php".
Click the button to change my message.
Click Me!