= Templating in PHP = We use Templateing in PHP language itself to provide web interface for XCache. Template Engines like [http://smarty.php.net Smarty] is hot these years, but some ppl jump out and say: "STOP IT, php itself is Template Engine already". But well... the way XCache choose isn't to prove something right or wrong, but just to make XCache iself '''lesser dependency'''. == Difference between php-programs and php-templates? == I'm not the rule maker, but i can try to classify for you if you wanna know. * Separate "Web Interface" logic from program logic(data/input processing/prepareing). * Never interactive with something like sql or complex api etc. * Use variable/data from your program/scripts, instead of making variable/data. (there can be some exceptions) * If you want to do anything that does not affect any of the interface, do it outside of tempalate! It's not part of template. == Difference between php-templating and other xx-language-templateing? == Pros: * Use all '''simple''' goodies in php. * Variable substitution is done easily. With heredoc or just write variable inside string. * Loops/Functions can be used to generate similar parts to reduce work. In Smarty u have, and only have "include", although u can use your own plugins. Cons: * {{{}}} is much more complex than {$a}. You won't complain about writing extra characters {{{len('') - len('{$a}')}}}, but what if you gotta write 100 or 1000 of them? * I wrote the tpl in about 10 minutes in smarty-alike language, but spent about 1 hr translating it into template in php language. * It's ugly, unless you're "scripter only" instead of "i'm also web designer". Anyway, we never want to lit a fire on this topic again, but to just explain what is used what we learned in XCache.