How does handlebars(HBS) interact with the database ?
Posted: Mon Sep 05, 2016 7:40 am
hey guys i just started using this blogging system called postleaf and it uses a templating language called handlebars http://handlebarsjs.com/ now i was wondering how handlebars really works , because on inpecting the code i found code like below:
Now the first piece of code:
I.E. the each function is something that would be done in PHP i believe , Now a while back i used twig .
I believe that HBS(handlebars) is javascript and twing on the other hand is a PHP Engine . How do these two compare.
Also how exactly does HBS interact with the database condidering that it is JS ??? thats one of my big questions .
Code: Select all
{{#each posts}}
<div class="sample animated fadeIn">
<div class="container">
<div class="title animated fadeInUp">
<a href="{{post_url}}">
<h1>{{title}}</h1>
</a>
</div>
{{> sidebar}}
</div>
</div>
<article class="excerpt animated fadeIn {{post_class}}">
<div class="container">
<p>{{excerpt words="100"}}…</p>
</div>
</article>
{{/each}}Code: Select all
{{#each posts}}
I believe that HBS(handlebars) is javascript and twing on the other hand is a PHP Engine . How do these two compare.
Also how exactly does HBS interact with the database condidering that it is JS ??? thats one of my big questions .