This commit is contained in:
parent
629114bac5
commit
bece225d84
5 changed files with 381 additions and 381 deletions
|
|
@ -1,35 +1,35 @@
|
|||
<?php
|
||||
class Template{
|
||||
var $page;
|
||||
|
||||
function Template($template = "HelloWorld!!!") {
|
||||
$this->page = $template;
|
||||
}
|
||||
|
||||
function replace_tags($tags = array()) {
|
||||
if (sizeof($tags) > 0)
|
||||
foreach ($tags as $tag => $data) {
|
||||
//$data = (file_exists($data)) ? $this->parse($data) : $data;
|
||||
$this->page = str_ireplace("{'" . $tag . "'}", $data, $this->page);//eregi_replace
|
||||
}
|
||||
else
|
||||
die("No tags designated for replacement.");
|
||||
}
|
||||
|
||||
function output() {
|
||||
echo $this->page;
|
||||
}
|
||||
|
||||
function getOutput() {
|
||||
return $this->page;
|
||||
}
|
||||
|
||||
function parse($file) {
|
||||
ob_start();
|
||||
include($file);
|
||||
$buffer = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $buffer;
|
||||
}
|
||||
}
|
||||
<?php
|
||||
class Template{
|
||||
var $page;
|
||||
|
||||
function Template($template = "HelloWorld!!!") {
|
||||
$this->page = $template;
|
||||
}
|
||||
|
||||
function replace_tags($tags = array()) {
|
||||
if (sizeof($tags) > 0)
|
||||
foreach ($tags as $tag => $data) {
|
||||
//$data = (file_exists($data)) ? $this->parse($data) : $data;
|
||||
$this->page = str_ireplace("{'" . $tag . "'}", $data, $this->page);//eregi_replace
|
||||
}
|
||||
else
|
||||
die("No tags designated for replacement.");
|
||||
}
|
||||
|
||||
function output() {
|
||||
echo $this->page;
|
||||
}
|
||||
|
||||
function getOutput() {
|
||||
return $this->page;
|
||||
}
|
||||
|
||||
function parse($file) {
|
||||
ob_start();
|
||||
include($file);
|
||||
$buffer = ob_get_contents();
|
||||
ob_end_clean();
|
||||
return $buffer;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue