Witam zastanawiam sie czym sie rozni klasa templatowa napisana w php od biblioteki smarty.
Mam taki kod :
<?php
class cTemplate
{
var $assign; // .... html ... {$cos} ... {$jakisinny}
var $parsed;
function parse ($_file_name)
{
if (!file_exists($_file_name))
{
echo "Nie znaleziono pliku: ".$_file_name;
return 0;
}
$this->parsed = file_get_contents($_file_name, 500000);
$i = 0;
if (isset($this->assign))
{
foreach ($this->assign as $key => $value)
{
$source[$i] = "{\{:content:}quot;.$key."}";
$destination[$i] = $value;
$i++;
}
}
if (!isset($source)) return $this->parsed;
return $this->parsed = str_replace($source, $destination, $this->parsed);
}
}
?>
czym on sie rozni od smarty?
czy smarty posiada jakies dodatkowe ciekawe przydatne funkcje?