Installation
The preferred way to install this extension is through composer., (*1)
Either run, (*2)
php composer.phar require --prefer-dist pavlinter/yii2-dot "dev-master"
or add, (*3)
"pavlinter/yii2-dot": "dev-master"
to the require section of your composer.json
file., (*4)
Usage
'Jim',
'age' => '35',
'msg' => 'Pellentesque non felis ligula',
],
[
'name' => 'Robert',
'msg' => 'Cras sagittis dapibus lacus',
],
[
'name' => 'Maikl',
'age' => '12',
],
[
'msg' => 'Cras sagittis dapibus lacus',
],
];
$this->registerJs('
var data = ' . Json::encode($data) .';
$("#comment-box-html").tmplHtml("comment", data);
$("#comment-box-append").tmplAppend("comment", data); //append each
$("#comment-box-prepend").tmplPrepend("comment", data); //prepend each
');
?>
'comment']) ?>
<div class="media">
<div class="media-body">
<div class="media-heading">
{{=it.name || 'Anonymous'}}
{{? it.age }}
<span class="label label-info">{{=it.age}}</span>
{{?}}
</div>
{{? it.msg }}
<p>{{=it.msg}}</p>
{{?}}
</div>
</div>