Download the PHP package moay/php-perl-template without Composer
On this page you can find all versions of the php package moay/php-perl-template. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package php-perl-template
Preamble
This is a full dump of the original project located at http://phphtmltemplate.sourceforge.net/
I only added a namespace and pushed it to composer so that people can use it.
It is provided as is without any kind of warranty. Feel free to submit improvements.
################################################################################
PHP-HTML::Template
http://phphtmltemplate.sourceforge.net/
################################################################################
A template system for PHP based on the HTML::Template Perl Module
Version 0.3.1
9-NOV-2002
################################################################################
Author: Juan R. Pozo, [email protected]
License: GNU GPL (included in file "LICENSE")
(c) 2002 by Juan R. Pozo
http://html.conclase.net/
http://www.planhost.net/
################################################################################
HTML::Template Perl module copyright by Sam Tregar
################################################################################
Please consider making a donation today. Visit my amazon.com wishlist at:
http://html.conclase.net/link/wishlist
Thank you :)
################################################################################
Table of contents
-
Information for users 1.1. Introduction 1.2. An example of use 1.3. Creating a template object 1.4. Template syntax 1.5. Options 1.6. Adding Parameters 1.7. Saving and loading compiled templates
-
Information for developers 2.1. How it works 2.1.1. Parse 2.1.2. Variable assignement 2.1.3. Variable substitution 2.2. Notation 2.3. To do
- Bugs
- Information for users
1.1. Introduction
PHP-HTML::Template is the implementation of a template system for use within PHP scripts, where template syntax is the same as that of Sam Tregar's HTML::Template Perl module: http://html-template.sourceforge.net/
HTML::Template supports variable substitution, conditional output, loop constructs (very useful!) and template includes.
A similar package for PHP is htmltmpl, written by Tomas Styblo: http://htmltmpl.sourceforge.net/ from which some functionalities have been taken.
In its current state PHP-HTML::Template is a set of classes written in PHP, but the aim is to convert it into a PHP 4 extension module, which will be much faster.
1.2. An example of use
This is a sample PHP script:
<? // Include the class file require_once("template.php");
// Create a template object. Remember to use =& not only = $template =& new Template("sample.tpl");
// Add values for the template variables $template->AddParam("title", "Hello World!");
// Show the output $template->EchoOutput(); ?>
The template file:
Hello World!
1.3. Creating the template object. When creating the template object, you must use the =& sign, not the = sign: WRONG: $template = new Template("test.tmpl"); CORRECT: $template =& new Template("test.tmpl"); If only one parameter is specified, it is taken as the template file name. In this case the template is created with the default options. To specify other options, you pass one (associative) array, containing option=>value pairs: $template =& new Template(array("option1"=>"value", "option2"=>"value")); Available options are described later in this document (section 1.5). 1.4. Template Syntax The template syntax is identical to that of HTML::Template, with some added functionalities taken from htmltmpl. The following text has been adapted from HTML::Template version 2.5 (original text written by Sam Tregar): THE TAGS TMPL_VARJob:
Number:
[[TMPL_VAR NAME="title"]]
parse_html_tags - (this option is not implemented in HTML::Template). Tells the parser to look for template tags inside HTML comments. If you are enclosing any of your template tags inside HTML comments for your template to be valid markup, leave this option as true. Otherwise set it to false, which will make parsing slightly faster. Default value is true. Examples: 1) In the script: $options = array('filename'=>'template.tmpl', 'imark'=>'<', 'emark'=>'>', 'parse_html_tags'=>true); In the template: =