What is TPLix

Learn what TPLix is — a PHP template engine that separates presentation from application logic using simple {tag} syntax. Fast, secure, and free to use.

TPLix is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic. PHP code is application logic — TPLix handles the presentation.

The Philosophy

The TPLix design was largely driven by these goals:

🎯 Clean separation of presentation from application code
🔧 PHP backend, TPLix template frontend
🤝 Complement PHP, not replace it
⚡ Fast development & deployment for programmers and designers
🛠️ Quick and easy to maintain
💡 Syntax easy to understand, no PHP knowledge required
🔌 Flexibility for custom development
🔒 Security: insulation from PHP
🆓 Free, open source

Templates: Two Camps of Thought

❌ Camp 1 — PHP as Template

Mixes PHP code directly with HTML. Fast in theory, but messy and hard to maintain. PHP works well for logic — not so well for markup.

✅ Camp 2 — TPLix Approach

Presentation is void of programming code. Simple {tags} indicate where content appears. Clean, focused, maintainable.

Why is Separating PHP from Templates Important?

✏️

Syntax

TPLix's simple {tag} syntax is designed specifically for presentation — intuitive for developers and designers alike.

PHP
<?php echo strtolower(
  htmlspecialchars(
    $title,ENT_QUOTES,'UTF-8'
  )
); ?>
TPLix
{$title|escape|lower}
🛡️

Sandboxing

TPLix insulates templates from PHP, creating a controlled separation of presentation from business logic. Security features can enforce granular restrictions — ideal when third parties edit templates.

🌍

Portability

TPLix templates are language-agnostic — they can be compiled to other languages such as JavaScript with a different compiler, and the syntax can be ported to other programming languages.

How Does it Work?

Under the hood, TPLix compiles template files into PHP scripts. Compilation happens once on first invocation — compiled versions are reused from that point forward. Since compiled output is pure PHP, op-code accelerators like APC or ZendCache continue to work.

TPLix Template → Compiled PHP → ⚡ Fast Execution

Template Inheritance

Before template inheritance, templates were managed in separate header/footer files — fragile and hard to maintain. With template inheritance, templates are maintained as single pages and blocks of content are manipulated by inheriting them. See Template Inheritance for more info.

What TPLix is Not

⚠️ TPLix is not an application framework, not an MVC, and not a replacement for CodeIgniter, CakePHP, or Zend Framework. TPLix is the (V)iew layer — it works alongside any framework.

Is TPLix Right for Me?

🖊️ Template Syntax

Are you content with PHP mixed with HTML? Would your designers prefer a clean tag-based syntax designed purely for presentation?

💼 The Business Case

Do you need to insulate templates from PHP? Do untrusted third parties edit your templates? Do you need fine-grained control over what is available in templates?

⚙️ Feature Set

Does TPLix's caching, template inheritance, and plugin architecture save development time compared to building these features from scratch?

Sites Using TPLix

Tens of thousands of developers visit the TPLix website daily. Well-known PHP projects using TPLix include:

🔗 WHASols 🔗 Hostarina 🔗 Samrahost 🔗 Solidhoster 🔗 Smstide 🔗 WhaShield 🔗 Modulesarena

Summary

Whether you are using TPLix for a small website or a massive enterprise solution, it can accommodate your needs:

✅ Separation of PHP from HTML/CSS just makes sense
✅ Readability for organization and management
✅ Security for 3rd party template access
✅ Feature completeness, easily extendable
✅ Massive user base — TPLix is here to stay
✅ LGPL license for commercial use
✅ 100% free to use, open source project