10-25-2008, 12:49 AM
|
#1 (permalink)
|
|
The Addict
Join Date: Aug 2008
Posts: 312
Thanks: 8
|
help in a templating class
Hi guys, this is my first actual php post here and it's about a problem with a line in the simple templating class that i have. the class it's this:
PHP Code:
<?php class View { public $template; public $d='%'; //delimiter function load($f) { $f=WEB_HOST.'components/'.$f; if(!file_exists($f)) return FALSE; $this->template = file_get_contents($f); } function delimit($delimeter) { $this->d=$delimeter; } function replace($var, $content) { $this->template = str_replace($this->d.$var.$this->d, $content, $this->template); } function publish() { eval("?>".$this->template."<?"); } } ?>
the problem seems to be in the function file_get_contents() because nothing seems to be saved in the template variable. I have tried change it by using file, fopen, fread functions and also even using curl, but nothing seems to save the text of the file in the variable. I am lost with this. Any help would help me, and thanks in advance
Also I would like your opinion in the publish function, i feel not very secure using the eval() function.
|
|
|
|