TagTemplate is a PHP library class for use with template files.
If you have no idea what that means, then this page will be of absolutely no interest to you.
Otherwise, read on...
There are many PHP template libraries available in the Open Source domain, but when I searched I was unable to find solutions to what I thought would be two very simple and common problems:
So I wrote my own.
TagTemplate is a class that performs both of the above tasks, plus a bit more. You decide which via a function parameter.
Using the first option, you can, for example, "include" one HTML file in another, but without the <HEAD> tag or anything not inside the <BODY>. Or you could include a JavaScript that's embedded in one HTML file into another. Or you could surround an arbitrary piece of HTML code with some invented tag (such as, <INCLUDED_BIT>This is to be included in other files</INCLUDED_BIT>) and extract that HTML code snippet for insertion into another file.
The best example of the use of the second option is to create a template HTML file that represents the stuff you want to have in every page in your site (such as the logo, the navigation buttons, the copyright message at the bottom, etc), and put some invented tag in it that represents where all the page-specific HTML should go (such as, <MY_BODY>This text inside is ignored</MY_BODY>). Then you make two calls to TagTemplate - the first to retrieve the HTML from before the <MY_BODY> tag, and the second to retrieve all the stuff after the </MY_BODY> tag.
You can download it (in zip format only) here.