[RESOLVED] include html template advice needed.
I have one major script that collects data and verifies that data before handing off to another script that writes it to the database. The first script has twenty or so different HTML forms to collect data.
Okay I would like to move each HTML form into a template file and then include the template files in the php script, thus making the code easy to read and allowing our designer, we love ya DF, to work on the templates independantly.
What is the best way to go about this so that
Code:
<?php
code line
code line
?>
<label>
<input>
<submit>
<?php
$check.item
code line
code line
becomes
Code:
<?php
code line
code line
include(html.tmp)
$check.item
code line
code line
Should I be turning off the php in the include file and will it then render the html, or should I somehow echo or print the html lines?
Re: include html template advice needed.
if your include has no PHP at all, you can just make it an HTML file and include that (otherwise, just make it a PHP file, and include it). there is no need to worry about "turning off" PHP in the include.
PHP Code:
<?php
//code
include("template1.htm");
check_something();
//more code
?>
just like your main page, your include is parsed as a regular PHP file. the parser doesn't care whether the page was included or not. you can "turn off" PHP and turn it back on freely and without consequence. hope that's what you were looking for.
Re: include html template advice needed.
Thanks kows, working like a brought one :) That's actually petty freaking cool.