Recommend this page to a friend! |
Download .zip |
Info | Documentation | View files (9) | Download .zip | Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 71 | All time: 9,897 This week: 347 |
Version | License | PHP version | Categories | |||
php-templater 1.0 | BSD License | 5 | HTML, PHP 5, Templates |
Description | Author | |
This package can process and render templates similar to AngularJS. |
This package can process and render templates similar to AngularJS.
Templates {{my.var}} for ['my'=>['var'=>'Hello, World']]
Based on regular expression.
$arr = [
'test' => [
'message' => 'Hello, World',
],
];
echo \frdl\Templater\SimpleDotNotationReplacer::replace(\frdl\Context::create($arr),
'Message: {{test.message}}');
//Message: Hello, World
Based on https://github.com/wmde/php-vuejs-templating .
$arr = [
'show' => false,
'test' => [
'message' => 'Hello, World',
],
'items' => [
[ 'property' => 'value1' ],
[ 'property' => 'value2' ],
],
];
echo \frdl\Templater\AdvancedReplacer::replace(\frdl\Context::create($arr),
'<div>
<h1 ng-bind="title"></h1>
<p>Message: {{test.message}}</p>
<p ng-show="show">this should be hidden</p>
<p ng-if="!show">this should be visible</p>
<p><a ng-repeat="item in items">{{item.property|ucfirst}}</a></p>
</div>');
/*
//Renders to:
<div>
<h1><p>Template Test Title</p></h1>
<p>Message: Hello, World</p>
<p>this should be visible</p>
<p><a>Value1</a><a>Value2</a></p>
</div>
*/
Files |
File | Role | Description | ||
---|---|---|---|---|
src (1 directory) | ||||
composer.json | Data | Auxiliary data | ||
LICENSE | Lic. | License text | ||
README.md | Doc. | Documentation |
Files | / | src | / | frdl | / | Templater |
File | Role | Description |
---|---|---|
AdvancedReplacer.php | Class | Class source |
Component.php | Class | Class source |
Replacer.php | Class | Class source |
ReplacerInterface.php | Class | Class source |
SimpleDotNotationReplacer.php | Class | Class source |
Templating.php | Class | Class source |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.