|
-
Mar 26th, 2009, 06:17 PM
#1
Thread Starter
Hyperactive Member
[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?
-
Mar 26th, 2009, 07:37 PM
#2
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.
Last edited by kows; Mar 26th, 2009 at 07:44 PM.
-
Mar 26th, 2009, 07:46 PM
#3
Thread Starter
Hyperactive Member
Re: include html template advice needed.
Thanks kows, working like a brought one That's actually petty freaking cool.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|