Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shakahl/hups-util-phptemplate
Extremely lightweight template class based on native PHP.
https://github.com/shakahl/hups-util-phptemplate
Last synced: about 1 month ago
JSON representation
Extremely lightweight template class based on native PHP.
- Host: GitHub
- URL: https://github.com/shakahl/hups-util-phptemplate
- Owner: shakahl
- License: mit
- Created: 2015-03-11T03:09:26.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T02:43:33.000Z (about 1 year ago)
- Last Synced: 2023-12-15T03:54:26.781Z (about 1 year ago)
- Language: PHP
- Size: 11.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PHPTemplate
===========Introduction
------------This package is a part of the Hups Framework. It is an extremely lightweight
template class based on native PHP.This library is forked from: https://github.com/lsolesen/php-template/
Installation
------------https://packagist.org/packages/shakahl/hups-util-phptemplate
Add `shakahl/hups-util-phptemplate` as a requirement to `composer.json`:
```javascript
{
"require": {
"shakahl/hups-util-phptemplate": "dev-master"
}
}
```Update your packages with `composer update` or install with `composer install`.
You can also add the package using `composer require shakahl/hups-util-phptemplate` and later specifying the version you want (for now, `dev-master` is your best bet).
Usage example
-------------
### Example for usage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
some_title = 'User list';
$tpl->userArray = array(
array(
"id" => 1,
"name" => "John Doe1"
),
array(
"id" => 2,
"name" => "John Doe2"
),
array(
"id" => 3,
"name" => "John Doe3"
)
);
$tpl->set('another_variable', 'some value');
$tpl->assign('another_variable2', 'some value');
$renderedOutput = $tpl->fetch('template-tpl.php');
$tpl->display('template-tpl.php');
?>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### Example template file
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Id
Name
Banned
another_variable; // Can be used like this ?>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unit testing
------------
### Under Windows
```
$ composer update
$ vendor/bin/phpunit.bat
```
### Under Linux
```
$ composer update
$ vendor/bin/phpunit
```