-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.php
More file actions
37 lines (28 loc) · 789 Bytes
/
Copy pathtemplate.php
File metadata and controls
37 lines (28 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?
/*
Usage:
$vars['PRICE'] = $product['single_price'];
$vars['RETAIL'] = $product['sugg_retail'];
template("/user/store/cat_browse_page.tpl", $vars);
*/
function template($name, $vars = "") {
global $TEMPLATE_DIR;
if (!($fp = @fopen($TEMPLATE_DIR . $name, "r"))) {
err(__FILE__, __LINE__, "Error reading template file" .
" $TEMPLATE_DIR$name");
}
while (!feof($fp))
$data = fread($fp, 4096);
fclose($fp);
$vars['PHP_SELF'] = $_SERVER['PHP_SELF'];
$vars['SUBMIT_METHOD'] = SMETHOD;
foreach($vars as $k => $v) {
$keys[] = "\{$k}";
$vals[] = $v;
}
$data = str_replace($keys, $vals, $data);
// Strip HTML comments
$data = preg_replace("/<!---.*--->/s", "", $data);
echo $data;
}
?>