Here is my 26 line PHP template engine that I have used for dozens of little web applications. It's clean, fast and mean. The templates are just PHP files. Nothing weird or strange about them.
class std_TemplateEngine{ var $data; var $useHeaderFooter = true; function std_TemplateEngine(){ $this->data=array(); } function assign($name,$item){ $this->data[$name]=$item; } function assignRef($name,&$item){ $this->data[$name] =& $item; } function display($templateName){ extract($this->data); include("templates/".$templateName.".html.php"); } function displayPage($templateName){ if($this->useHeaderFooter){ $this->display("pageHeader"); $this->display($templateName); $this->display("pageFooter"); }else{ $this->display($templateName); } } }
Controller code
<? $t = new std_TemplateEngine(); $t->assign("title","Chunky Bacon"); $t->assign("lucky_numbers",[1,2,7]); $t->display("document_view"); ?>
Template code (templates/document_view.html.php)
<h1><?=$title?></h1> <ul> <? foreach($lucky_numbers AS $number){ ?> <li><?=$number?></li> <? } ?> </ul>
So I was testing out a locations specfic search engine, and this was the news item that came up: S.C. Teen Arrested for Spitting in Coffee.
The best overview of real life freelance development I've read: So you want to be a consultant?.