Download the PHP package susros/html-template-engine without Composer

On this page you can find all versions of the php package susros/html-template-engine. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package html-template-engine

HTMLTemplateEngine is an easy, simple and lightweight templating engine library for PHP.

Requirement

PHP Version 5.3 or higher.

Installation

HTMLTemplateEngine can be manually downloaded or cloned by using:

HTMLTemplateEngine is also available on Packagist. To install with composer, add this line to yoru :

or just run:

Templates

The extension of template files is either tpl or html. Template files are all organised in different folders called packages. In each package, there can be just template files or folders to organise or categorise template files.

Here is an example of directory structure for templates:

Template Variables

Template variable is the placeholder for the actual value. The default value can be assigned to the variable. If the default value is not declared, an empty string will be used as default value.

Syntax Description
{$var} Variable without default value
{$var : "default value"} Variable with default value

Example:

Template Function

Template functions are used to tell what actions does template engine need to do when the template is being executed. There are two functions supported.

dup

'dup' template function is used to tell template engine to duplicate the template after the values are assigned to variables of the template.

Syntax Description
{#dup : [Template contents] ;} Duplicate the template contents

For example:

loop

'loop' template function is used to tell template engine to make an 'n' copies of templates.

Syntax Description
{#loop(n) : [Template contents] ;} Make n copies of template contents

For example:

Usage

First, include the HTMLTemplateEngine class file. HTMLTemplateEngine is using namespace HTMLTemplateEngine.

Before using HTMLTemplateEngine, please make sure to set the directory of template files. As default, it is set to the current directory of the application.

For example:

Then, template files can be passed through HTMLTEmplateEngine object initiator:

You can get the template by calling package name as static method with the syntax:

For example, to get the template1.tpl from cat1 of package1 as shown in the example above in Templates section:

Once the template engine has been initiated, you can now access template variables in template files just like accessing object's variables. Template variables can be assigned as single value or array.

If we look at the example from the Template Variables section above:

The output of template will be:

The variable $name was not assigned. Therefore, default value "World" is used. The variable $msg is assigned with the value "Good Morngin!" and thus it is used. Otherwise, empty string will be used.

As for the template function 'dup', it will automatically be recognised by HTMLTemplateEngine when the template is being executed with the variables values. Since we want to duplicate the template and assign with different values for each duplicated template, we need to use array in this case. For example, by using the dup template above:

The output will be:

Similar to 'dup' template function, HTMLTemplateEngine will automatically recognise the function 'loop'. It will generate the specified number of copies of the template. For example:

The output will be:


All versions of html-template-engine with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package susros/html-template-engine contains the following files

Loading the files please wait ....