mirror of
https://github.com/Mibew/handlebars.php.git
synced 2024-11-15 08:44:12 +03:00
Add travis yaml file
This commit is contained in:
parent
2af461c7f6
commit
97989f1cdd
4
.travis.yml
Normal file
4
.travis.yml
Normal file
@ -0,0 +1,4 @@
|
||||
language: php
|
||||
php:
|
||||
- 5.3
|
||||
- 5.4
|
@ -1,6 +1,9 @@
|
||||
{
|
||||
"name": "xamin/handlebars.php",
|
||||
"description": "Handlebars processor for php",
|
||||
"homepage": "https://github.com/bobthecow/mustache.php",
|
||||
"type": "library",
|
||||
"license": "GPLv3",
|
||||
"authors": [
|
||||
{
|
||||
"name": "fzerorubigd",
|
||||
@ -9,5 +12,8 @@
|
||||
],
|
||||
"require": {
|
||||
|
||||
},
|
||||
"autoload": {
|
||||
"psr-0": { "Handlebars": "src/" }
|
||||
}
|
||||
}
|
||||
|
@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
require "Template.php";
|
||||
require "Engine.php";
|
||||
require "Context.php";
|
||||
require "Tokenizer.php";
|
||||
require "Parser.php";
|
||||
|
||||
require "Cache.php";
|
||||
require "Cache/Dummy.php";
|
||||
require "Loader.php";
|
||||
require "Loader/StringLoader.php";
|
||||
require "Helpers.php";
|
||||
|
||||
|
||||
$temp = <<<END_HERE
|
||||
<div id="message"> {{!Place holder for message, leave it be in any case}}
|
||||
{{#if error}}
|
||||
<ul>
|
||||
{{#each errors}}
|
||||
<li>{{.}}</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{#with t}}
|
||||
{{{form}}}
|
||||
{{/with}}
|
||||
{{>Test}} {{! since there is no Test partial and loader is string loder, just Test is printed out}}
|
||||
{{{slots.search}}}
|
||||
|
||||
{{slots.tags}}
|
||||
|
||||
Test
|
||||
|
||||
{{#each t.errors}}
|
||||
<li>{{.}}</li>
|
||||
{{/each}}
|
||||
END_HERE;
|
||||
|
||||
|
||||
|
||||
$contextArray =
|
||||
[
|
||||
'error' => true,
|
||||
'errors' => ['err1', 'err2', 'err3'],
|
||||
'slots' => [ 'search' => '<b>search</b>' ,'tags' => '<b>tags</b>'],
|
||||
't' =>
|
||||
[
|
||||
'errors' => ['t.err1', 't.err2'],
|
||||
'form' => '<form></form>'
|
||||
]
|
||||
];
|
||||
$engine = new Handlebars_Engine();
|
||||
|
||||
$helper = new Handlebars_Helpers();
|
||||
|
||||
|
||||
$engine->setHelpers($helper);
|
||||
|
||||
echo $engine->render($temp, $contextArray);
|
Loading…
Reference in New Issue
Block a user