PHP Classes

InTpl PHP Template Engine Inheritance: Render templates that inherit from other templates

Recommend this page to a friend!
  Info   View files Example   View files View files (7)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-03-23 (2 months ago) RSS 2.0 feedNot enough user ratingsTotal: 52 All time: 10,643 This week: 63Up
Version License PHP version Categories
intpl 1.1.3Artistic License5PHP 5, Templates


This class can render templates that inherit from other templates.

It can take a template file that is a PHP script contains HTML mixed with PHP code with template commands and executes the script to render the template output.

Template PHP scripts can inherit from other templates using a call to this class to include other base template PHP scripts.

Picture of Nikos M.
Name: Nikos M. is available for providing paid consulting. Contact Nikos M. .
Classes: 18 packages by
Country: Greece Greece
Age: 47
All time rank: 8489 in Greece Greece
Week rank: 20 Up1 in Greece Greece Up
Innovation award
Innovation award
Nominee: 7x

Winner: 2x



('ROOT', dirname(__FILE__));

ROOT . '/../src/InTpl.php');

InTpl::Tpl('tpl3.php', ROOT)->render();



Simple PHP templates supporting Template Inheritance.

see also:

  • ModelView a simple, fast, powerful and flexible MVVM framework for JavaScript
  • tico a tiny, super-simple MVC framework for PHP
  • LoginManager a simple, barebones agnostic login manager for PHP, JavaScript, Python
  • SimpleCaptcha a simple, image-based, mathematical captcha with increasing levels of difficulty for PHP, JavaScript, Python
  • Dromeo a flexible, and powerful agnostic router for PHP, JavaScript, Python
  • PublishSubscribe a simple and flexible publish-subscribe pattern implementation for PHP, JavaScript, Python
  • Importer simple class &amp; dependency manager and loader for PHP, JavaScript, Python
  • Contemplate a fast and versatile isomorphic template engine for PHP, JavaScript, Python
  • HtmlWidget html widgets, made as simple as possible, both client and server, both desktop and mobile, can be used as (template) plugins and/or standalone for PHP, JavaScript, Python (can be used as plugins for Contemplate)
  • Paginator simple and flexible pagination controls generator for PHP, JavaScript, Python
  • Formal a simple and versatile (Form) Data validation framework based on Rules for PHP, JavaScript, Python
  • Dialect a cross-vendor &amp; cross-platform SQL Query Builder, based on GrammarTemplate, for PHP, JavaScript, Python
  • DialectORM an Object-Relational-Mapper (ORM) and Object-Document-Mapper (ODM), based on Dialect, for PHP, JavaScript, Python
  • Unicache a simple and flexible agnostic caching framework, supporting various platforms, for PHP, JavaScript, Python
  • Xpresion a simple and flexible eXpression parser engine (with custom functions and variables support), based on GrammarTemplate, for PHP, JavaScript, Python
  • Regex Analyzer/Composer Regular Expression Analyzer and Composer for PHP, JavaScript, Python



<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title><?php $this->start('title'); ?>No Title<?php $this->end('title'); ?></title>

<?php $this->start('content'); ?>
No Content
<?php $this->end('content'); ?>


<?php $this->extend('layout/base.tpl.php'); ?>

<?php $this->start('title'); ?>Index<?php $this->end('title'); ?>

<?php $this->start('content'); ?>
<p>Index page</p>
<?php $this->end('content'); ?>

driver code:


define('VIEWS', dirname(__FILE__));

include(VIEWS . '/InTpl.php');

echo InTpl::Tpl('index.tpl.php', [VIEWS])->render([/../]);


<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


<p>Index page</p>

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Files folder imagetest (5 files)
Accessible without login Plain text file Doc. Read me

  Files folder image Files  /  src  
File Role Description
  Plain text file InTpl.php Class Class source

  Files folder image Files  /  test  
File Role Description
  Accessible without login Plain text file out Output Processed template output
  Accessible without login Plain text file test.php Example Example script
  Accessible without login Plain text file tpl1.php Data Template script
  Accessible without login Plain text file tpl2.php Data Template script
  Accessible without login Plain text file tpl3.php Data Template script

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:10,643
This week:63Up