The open-source template engine that lets you easily and completely separate your PHP and HTML code, without learning a new language.

The New Normal

Why Use a Template Engine?

Just as modern websites use different files for page structure (HTML),behavior (JavaScript) and presentation (CSS),template engines enable application logic (PHP) to also remain separate (a template "layer"). PHP files "parse" their corresponding HTML template and special tags are individually replaced with content defined by the PHP code. You can therefore allow designers with no knowledge of PHP to modify page structure, and optionally limit access to application logic. Code separation also results in improved code readability. Once you start using a template engine you won't look back!

For Any Website or Application

Why Use PHPTemplateLayer?

We developed PHPTemplateLayer with the wide-ranging features and fast performance required for hundreds of our own websites. PHPTemplateLayer is possibly the easiest PHP template engine to install, setup and learn, even with no prior template experience. Since all control of template output remains with the PHP code, template tags are clean and easy, and no new security concerns are introduced. PHPTemplateLayer is 100% free to use and open source, and now even outputs minified HTML.

PHPTemplateLayer Features

  • Flexible Template Parsing
    • Your template can be a file or a variable (e.g. from a database)
    • Decide if you want unassigned variables and blocks removed or retained during parsing (useful if you want to cache some of your template to a database and then re-parse the remaining variables and blocks another time)
    • You can choose to display your parsed template or return it as a variable
    • Permanently exclude any portion of your template from parsing using Ignore tags
    • Automatically serve minified HTML output from non-minified templates (optional)
  • Assign Variables Easily
    • Values are assigned to template variables using just their name - all control of template output remains with the PHP code.
    • Assign global variables to be used anywhere in your template
    • Assign multiple variable values at the same time by using associative arrays
  • Full Block Support
    • Use dynamic blocks for conditional portions of your template (e.g. error messages)
    • Use unlimited nested blocks for recurring portions of your template (e.g. database results)
Want news and insights from SiteCenter?
Send me your newsletter about industry trends plus news of SiteCenter products and services.
You can unsubscribe at any time, and we promise to never share your email address - read our Privacy Policy.
© Copyright 2023. All rights reserved. All other trademarks and copyrights are property of their respective owners.