mirror of
https://github.com/Mibew/handlebars.php.git
synced 2025-05-02 10:16:41 +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",
|
"name": "xamin/handlebars.php",
|
||||||
"description": "Handlebars processor for php",
|
"description": "Handlebars processor for php",
|
||||||
|
"homepage": "https://github.com/bobthecow/mustache.php",
|
||||||
|
"type": "library",
|
||||||
|
"license": "GPLv3",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "fzerorubigd",
|
"name": "fzerorubigd",
|
||||||
@ -9,5 +12,8 @@
|
|||||||
],
|
],
|
||||||
"require": {
|
"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