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    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 40 All time: 10,282 This week: 208Up
Version License PHP version Categories
intpl 1.0Artistic License5PHP 5, Templates
Description Author

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: 14 packages by
Country: Greece Greece
Age: 45
All time rank: 9909 in Greece Greece
Week rank: 54 Up1 in Greece Greece Up
Innovation award
Innovation award
Nominee: 5x

Winner: 1x



Simple PHP templates supporting Template Inheritance.



<!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', array(VIEWS))->render(array(/../));


<!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,282
This week:208Up
For more information send a message to info at phpclasses dot org.