Hello.
I'm trying for one of those sites where you have all your HTML in file A and all your PHP in file B.
<?
// Grab the template page into a variable
$template = implode('', file('template.html'));
// Set the replacements for the template page
$variables = array( "USERNAME" => "ThaSpY", "TIME" => "7:41:02 PM EST" );
// Replace the template page with their new values
while( list( $key, $value ) = each( $variables ) )
{
$template = ereg_replace( "{" . $key . "}", $value, $template );
}
// Display page
echo $template;
/*
TEMPLATE.HTML
<html>
Welcome back, {USERNAME}<br>
Time: {TIME}
<!-- BEGIN members -->
{members.NAME} {members.PASSWORD} {members.EMAIL}<br>
<!-- END members -->
</html>
*/
?>
This is actually similar to phpBB's system (Where I got the idea, I don't know how standard it is). I got the curly brackets working, but how exactly would I code it on the PHP side for a WHILE loop or an IF ELSE statement, and then replace the above sample with the new PHP statements to complete the page.
Any help would be welcomed. Even if I am totally off with this, I'm sure you understand what I want to accomplish, and I'd appreciate if you could send me in the right direction.
Thanks!