Delivering the best Add-Ons in more than 37 languages.

中文(简体), English, हिन्दी/हिंदी, Español/Castellano, العربية, Русский язык, Français, 中文 (台灣), বাংলা, Bahasa Indonesia, اردو, Português, Deutsch, Bahasa Melayu (بهاس ملايو‎), 日本語 (にほんご), فارسی, Italiano, తెలుగు, Türkçe, ગુજરાતી, Język polski/polszczyzna, Tiếng Việt, ಕನ್ನಡ, Українська мова, ไทย
PHP Scripts / Miscellaneous

PHP Template Class

— Add-On to

Subscribe to our feed to stay up to date!

New! Follow us as you want it!

PHP Template Class - CodeCanyon Item for Sale


Ad: Bluehost hosting

With PHP template class you can completely separate your PHP code from your HTML without sacrificing performance or dealing with dozens of additional files to do so.


  • Easy to install
  • Lightweight single PHP file (12kb)
  • PHP 5 OOP makes it easy to extend
  • Caches compiled templates until they’re modified
  • Combines css and javascript files into single files
  • Compresses css and javascript files using YUI Compressor
  • Supports if, elseif, else, and include from within template
  • Supports looped data within template


  • Supports PHP 5.x or later.
  • Ability to execute.jar files via PHP ’s exec() function is required for compressing css and javascript files.


11/04/11 v1.5
  • Updated the code in which the cache file’s validity is checked.
10/21/11 v1.4
  • Added another optional parameter to the display() function that allows you to combine css and js files into a single file. (Caches combined file until any of the individual files are modified).
    // Will combine css and javascript files to 'combined.css' and 'combined.js'
    $css = array('global.css', 'style.css');
    $template->display('Page Title', 'template-file.html', $css, 'jquery.js', 'combined');
  • Added the option to compress css and js files using the YUI Compressor when the above parameter is used. (Falls back to uncompressed version if compression fails).
6/29/11 v1.3
  • Added ability to pass css and javascript files through the template class via the display() function by either string or array.
    $css = array('global.css', 'style.css');
    $template->display('Page Title', 'template-file.html', $css, 'jquery.js');
    <!-- EMBED CSS -->
    <!-- EMBED JS -->
08/13/10 v1.2
  • Cache folder is now created if it doesn’t exist
08/08/10 v1.1
  • Configuration settings can now be passed to class when called:
    $config = array('root' => 'template/', 'cache' => 'cache/');
    $template = new template($config);

Other components in this categoryAll components of this author
CommentsFrequently asked questions and answers


25 June 10

Last Update:
5 November 11

Software Version:
PHP 5.x, jQuery

Files Included:


eCommerce, All Items, template