ArKadia template system is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic. This implies that PHP code is application logic, and is separated from the presentation.
The ArKadia template system design was largely driven by these goals:
When it comes to templating in PHP, there are basically two camps of thought. The first camp exclaims that “PHP is a template engine”. This approach simply mixes PHP code with HTML. Although this approach is fast from a pure script-execution point-of-view, many would argue that the PHP syntax is messy and difficult to maintain when mixed with presentation. PHP works well for programming, but not so well for templating.
The second camp exclaims that presentation should be void of all programming code, and instead use simple tags to indicate where application content is revealed. This approach is common with other template engines (and other programming languages), and is the approach that ArKadia takes. The idea is to keep the templates focused squarely on presentation, void of application code, and with as little overhead as possible.
There are many benefits of separating PHP code from templates, some of which are:
<?php echo strtolower(htmlspecialchars($title,ENT_QUOTES,UTF-8)); ?>
<#title lowercase=1 htmlencode=1>
No different than PHP being an abstraction layer on top of C to simplify development, ArKadia is an abstraction layer on PHP to simplify template maintenance.
For a syntax comparison of PHP vs ArKadia, see Syntax Comparison.
A common question: “Web designers have to learn a syntax anyways, why not PHP?” Of course web designers can learn PHP, and they may already be familiar with it. The issue isn't their ability to learn PHP, it is about the maintenance of PHP mixed with HTML. <#tags> are simpler, more intuitive, and less fragile than PHP statements. Templates also restrict what can be put in a template. PHP makes it too easy to add code into templates that doesn't belong there. You could teach designers the rules of application design, but this is should be unnecessary (now they are developers!) The PHP manual is intended for developers. Designers would only need a small fraction of this manual, and it doesn't make it easier for them to find what they need. ArKadia gives web designers exactly the tools they need, and gives developers fine-grained control over these tools.
Although ArKadia gives you the tools to make a clean separation of presentation from application code, it also gives you plenty of room to bend those rules. A poor implementation (i.e. injecting PHP in templates) will cause more problems than the presentation separation was meant to resolve. The documentation does a good job of indicating what things to watch out for. Also see the Best Practices section.
The Crash Course section gives a good overview how ArKadia is typically implemented in a PHP application.
Under the hood, ArKadia compiles copies of the templates as PHP scripts. This way you get the benefits of both template tag syntax and the speed of PHP. Compilation happens once when each template is first invoked, and then the compiled versions are used from that point forward. ArKadia takes care of this for you, so the template designer just edits the ArKadia templates and never has to manage the compiled versions. This approach keeps the templates easy to maintain, and yet keeps execution times extremely fast. Since the compiled versions are PHP, op-code accelerators such as APC or ZendCache continue to work on the compiled scripts.