PHP Pre-Processing with XMake: PHP Templating |
>> << output: build-versus-run-time.php |
<html>
<head>
<title>phpc example: build versus run-time code execution</title>
</head>
<body>
This file was built on: Friday 02nd of May 2003 01:06:29 AM<br>
<b class="comment">begin readfile() run-time code</b><br />
<?php
// this code will be executed at run time
import_request_variables ("GPC");
$default_lang="en";
if (empty( $lang )) $lang=$default_lang;
$template_file=getcwd()."/build-versus-run-time.php.template.$lang";
if (!file_exists( $template_file)){
echo("ERROR: language not supported: $lang <br />\n");
trigger_error("ERROR: language template file does not exist:\n $template_file",E_USER_WARNING);
} else {
include( $template_file);
}
?>
<b class="comment">end readfile() run-time code</b><br />
<b class="comment">begin embedded run-time code</b><br>
<?php // this code will be executed at run time
import_request_variables ("GPC");
echo ("user=$user\n<br>");
echo ("language=$lang\n<br>");
?>
<b class="comment">end embedded run-time code</b><br>
</body>
</html>
>> << Copyright (c) 2003, Gregory Keranen. All rights reserved. |