Reusable HTML Layouts With PHP Template Inheritance

PHP Template Inheritance (TI) is a PHP library for creating reusable HTML layouts (templates) for a site, using template inheritance technique. Since PHP TI lets you write everything in straight PHP, there is no need to learn another template language.

Compared to other template libraries PHP TI is very easy to use. Template Inheritance usually involves two separate templates, each in their own file: the parent template and the child template. The parent contains the HTML skeleton and markers for where content should go (this is where you call PHP TI using require_once). These markers are called blocks. The child then “fills-in” the blocks with content.

Features

  • Supports Empty Blocks
  • Default Block Content & Overriding
  • Every Block is always Executed
  • Keep a parent’s block and incorporate additional content using Super Block
  • Supports Nested Blocks
  • Modify a block’s content before it is sent to the output using Block Filters
  • Supports Base With No Blocks
  • Utilizes PHP’s native output buffers and does not rely on any kind of expensive parsing

Developed by Adam Shaw; PHP Template Inheritance (TI) is available for download under MIT License. You can find further information, samples &  download on PHP Template Inheritance (TI) Website.

Stay Updated

If you found this post useful, consider subscribing to our RSS Feed! You can also stay updated by following us on Twitter and Facebook or by subscribing to our FriendFeed.

Bookmark / Share

Bookmark and Share

Read More

SIMILAR/RELATED POSTS:

PREVIOUS POST:

NEXT POST:

Reader Comments

One Response to “Reusable HTML Layouts With PHP Template Inheritance”
  1. Erken says:

    Cool stuff! Very lightweight and useful! Thanks for the link!

Leave Comment

 
 

Stay Updated, Subscribe to RSS Feed

 
 
 
 

Blogroll

 

Sponsored Links