Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected function showTemplate() {
- ob_start('ob_gzhandler');
- $templateFileContents = file_get_contents($this->templateFileLocation);
- $outputHTML = $this->replaceVariables($templateFileContents);
- eval("?>".$outputHTML);
- ob_end_flush();
- }
- private function replaceVariables($templateContents) {
- if(file_exists(PROJECT."config/templateinfo.php")) {
- require_once(PROJECT."config/templateinfo.php");
- foreach($templateinfo as $key => $value) {
- $requiredVars = "{".$key."}";
- $replaceVars = "(".$key.")";
- for($i=1;$i<=1;$i++) {
- if(strpos($templateContents,$requiredVars) == true) {
- $requireContent = file_get_contents($value);
- $templateContents = str_replace($requiredVars, $requireContent, $templateContents);
- }
- }
- if(strpos($templateContents,$replaceVars) == true) {
- $templateContents = str_replace($replaceVars, $value, $templateContents);
- }
- }
- return $templateContents;
- } else {
- $this->errors->addFatalError("The template engine could not parse the code provided to it.");
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement