Class Template
Provides templating functionality
Usage
PHP file: index.php
require_once('include/sleepy.php'); $page = new Template('templates/default.tpl'); $page->bind('title', 'Sleepy Mustache'); $page->bind('header', 'Hello world!'); $page->show();
Template file: \app\templates\default.tpl
<html>
<head>
<title>{{ title }}</title>
</head>
<body>
<h1>{{ header }}</h1>
<p>This page has been viewed {{ hits }} times.</p>
</body>
</html>
Changelog
Version 1.7
- Updated private prefix (_) for consistency
- Updated documentation
Version 1.6
- No longer dependant on Hooks Module
Namespace: Sleepy
License: http://opensource.org/licenses/MIT
Author: Jaime A. Rodriguez hi.i.am.jaime@gmail.com
Version: 1.7
Todo: add #if
Date: June 18, 2016
Located at class.template.php
License: http://opensource.org/licenses/MIT
Author: Jaime A. Rodriguez hi.i.am.jaime@gmail.com
Version: 1.7
Todo: add #if
Date: June 18, 2016
Located at class.template.php
public
|
|
private
Bool
|
|
private
mixed
|
#
_assignArrayByPath( array $arr, string $path )
Given a path, the function returns a piece of $arr. For example 'name.first' will return $arr['name']['first'] |
private
string
|
|
private
string
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
mixed
|
|
public
|
|
public
|
public
string
|
$extension
The extension for template files |
#
'.tpl'
|
public
string
|
$directory
The template directory |
|
protected
string
|
$_file
The template file |
|
protected
mixed[]
|
$_data
The data bound to the template |
#
array()
|