I'm working on a small template project and I was wondering how I could make this code more compact and/or better
The htm
<html><body>
<table cellpadding="0" spacepadding="0" border="0">
<tr>
<td valign=top align=left><main></td>
<td valign=top align=left><size></td>
</tr>
</table>
</body>
</html>
The vars.php
<?php
$main = 'Something here.';
$description = 'This will be textarea1.';
$cname = 'The clients name.';
$address = 'The address.';
$size = 'Size of item.';
$color = 'What color.';
$other ='Other info, this is textarea2.';
?>
The processor.php
<?php
function template($content) {
global $main;
$filename = "theme.htm";
if(!$fd = fopen($filename, "r")) {
$error = 1;
}
else {
$template = fread ($fd, filesize ($filename));
fclose ($fd);
$template = stripslashes($template);
$template = str_replace("<main>", "$main", $template);
$template = str_replace("<description>", "$description", $template);
$template = str_replace("<cname>", "$cname", $template);
$template = str_replace("<address>", "$address", $template);
$template = str_replace("<color>", "$color", $template);
$template = str_replace("<content>", "$content", $template);
echo "$template";
} }
function home() {
global $main;
include ("themevars.php");
template("$data");
}
switch($action) {
default: // default switch
home();
break;
}
?>
thanks