Skip to content
This repository has been archived by the owner on Jun 20, 2019. It is now read-only.

Canteen/CanteenParser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#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.