Nedir gerçek web sitelerinin içine html şablonları aktarmak için, php kullanarak ve gerçek veriler ile tutucular yerine kendi şablon motoru oluşturmak için en iyi yolu ... iyi, benim kendi soru çözelim ...
class Template{
$private $output = '';
public function Load_Template($template){
ob_start();
include($template);
$this->output = ob_get_clean();
}
public function Replace($data){
$this->output = str_replace(array_keys($data), array_values($data), $this->output);
}
public function Display($add_footer = true){
echo $this->output;
}
}
Bu gibi basit bir şablon için çalışacak ...
<div>{username}</div>
But what would be the best way to do it with loops in my template. Lets say something like
<ul>
<li>{username}</li>//Loop this line for each user
</ul>
Ayrıca, ben smarty gibi bir üçüncü taraf motoru kullanmak istemiyorum, ben sadece kendim nasıl bilmek istiyorum. Teşekkür ederim