PHP Classes
elePHPant
Icontem

DEV Template Class: Template engine with theme and insert support

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (10)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2006-02-16 (9 years ago) RSS 2.0 feedNot enough user ratingsTotal: 1,098 All time: 3,236 This week: 1,117Up
Version License Categories  
devtemplate 1.0GNU General Publi...Templates
Description Author  

This class implements a template engine that supports themes and external template file insertion.

It works by searching and replacing placeholder marks by parameter values in the template files.

It supports defining a major template file that works as a replaceable theme template.

Key Features:

- Single line command usage with the express function
- Morph one template to another
- Recursive insert
- Arbitrary number of insert tags in single line command usage

Picture of Volkan Küçükçakar
Name: Volkan Küçükçakar <contact>
Classes: 2 packages by
Country: Turkey Turkey
Age: 35
All time rank: 5268 in Turkey Turkey
Week rank: 833 Down18 in Turkey Turkey Down

Details provided by the author  
 DEV Template Class - Teplate class for PHP - File Name: class.DevTemplate.php
 Copyright (C) 2005 Volkan Küçükçakar. All Rights Reserved.
 (Volkan Kucukcakar)
 http://www.developera.com
 
 You are requested to retain this copyright notice in order to use
 this software.

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the  Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


Info
=====

 Name          : DEV Template Class
 Version       : 0.3 beta
 Date          : 2005.09.04
 File          : class.DevTemplate.php
 Author        : Volkan Küçükçakar
                (Volkan Kucukcakar)
 EMail         : volkank@developera.com
 Home Page     : http://www.developera.com
 Description   : DEV TEMPLATE CLASS

                            ***** The main objective of this class is to statically design
                                  all of your page HTML with your favorite HTML editor
                                  and dynamically insert some parts to it with PHP.
                                  Also change the whole "theme" by changing only
                                  major_html template. (All other template files will
                                  be morphed to it...)

                                  Key features:

                 -Very easy to prepare and use.
                 -Single line usage by "express" function.
                 -Morph one template to another.
                 -Recursive insert
                 -Any number of insert tags altough in single line command usage

History
========

 v0.1: Foundation.
 v0.2 beta: -Single line usage by "express" function.
            -Morph one template to another.
            -Recursive insert
            -Multiple morph and insert tags
 v0.3 beta: -some comments




Known bugs
==========
   Problems may occur if there is more than one morph_tag and one morph_tag encapsulate another.
   This is why i have first designed morphing for single tag usage and its usually adequate.
   

Notes
=====

***** Usually preferred usage is only insert tags (example 1,2) or 
      one morph_tag and multiple insert_tags(example 3)
  
No problems with multiple insert tags...



Examples of most common usage
=============================

 1- Simple Usage:
 $DevTemplate->express("_page1.html","","",Array("date=$date"));

 2- Recursively Insert:
 $DevTemplate->express("_page1.html","","",array("hello=HELLO <!--insert:world-->","world=WORLD"));

 3- Complex Usage:
 $DevTemplate->express("_template.html","_page1.html","mainpart",array("hello=HELLO WORLD !","date=$date","title=This page title inserted dynamically..!"));

 4- Simple Usage Without Exit:
 $output_html=$DevTemplate->express("_page1.html","","",Array("date=$date"),false);

       HTML Tags
       =========
       
       There is only one tag for simple usage <!--insert:name-->
       There are two morph_tags for complex usage <!--start:name--> and <!--end:name-->

See all example files-comments for tags and more information.











  Files folder image Files  
File Role Description
Files folder imageExample1 (2 files)
Files folder imageExample2 (2 files)
Files folder imageExample3 (3 files)
Plain text file class.DevTemplate.php Class DEV Template Class
Accessible without login Plain text file License.txt Lic. License
Accessible without login Plain text file Readme.txt Doc. Readme

  Files folder image Files  /  Example1  
File Role Description
  Accessible without login Plain text file index.php Example Example 1
  Accessible without login Plain text file _page1.html Data Example 1

  Files folder image Files  /  Example2  
File Role Description
  Accessible without login Plain text file index.php Example Example 2
  Accessible without login Plain text file _page1.html Data Example 2

  Files folder image Files  /  Example3  
File Role Description
  Accessible without login Plain text file index.php Example Example 3
  Accessible without login Plain text file _page1.html Data Example 3
  Accessible without login Plain text file _template.html Data Example 3 - Theme (Morhp) example

 Version Control Unique User Downloads Download Rankings  
 0%Total:1,098All time:3,236
 This week:0This week:1,117Up