canteen / parser
Simple engine for rendering HTML templates.
Installs: 1 044
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2020-01-20 03:38:51 UTC
README
#Canteen Parser
Canteen Parser is a library for managing, loading and rendering templates. For documentation of the codebase, please see Canteen Parser docs.
##Installation
Install is available using Composer.
composer require canteen/parser dev-master
Including using the Composer autoloader in your index.
require 'vendor/autoload.php';
##Sample Usage
use Canteen\Parser\Parser; $parser = new Parser(); // Load an optional list of templates $parser->addTemplate('MyTemplate', 'MyTemplate.html'); // Render the template with some substitutions echo $parser->template( 'MyTemplate', [ 'title' => 'My Page', 'description' => 'Description goes here!' ] );
The contents of MyTemplate.html
<h1>{{title}}</h1> <div class="description">{{description}}</div>
Would echo:
<h1>My Page</h1> <div class="description">Description goes here!</div>
###Rebuild Documentation
This library is auto-documented using YUIDoc. To install YUIDoc, run sudo npm install yuidocjs
. Also, this requires the project CanteenTheme be checked-out along-side this repository. To rebuild the docs, run the ant task from the command-line.
ant docs
##License##
Copyright (c) 2013 Matt Karl
Released under the MIT License.