ive got the basic Consept

i currently have:
[php]
public function output() {
if (!file_exists($this->file)) {
return "Error loading template file ($this->file).<br />";
}
$output = file_get_contents($this->file);
foreach ($this->values as $key => $value) {
$left_delimiter = '<[';
$right_delimiter = ']>';
$search = '/\{php\}(.*?)\{\/php\}/is';
$replace = '<?php $1 ?>';
$tagToReplace = $left_delimiter.$key.$right_delimiter;
$output = str_replace($tagToReplace, $value, $output);
$output = preg_replace($search,$replace, $output);
}
return $output;
}
[/php]
but i have a problem, 2 $outputs isnt what i want so i need to really do two str_replace()'s
ive tried
str_replace()&&str_replace();
But it dont work :/
any other Methods?
phpkid