0

I have a question for you and please help me. I use this library in my project : https://github.com/XaminProject/handlebars.php. Now from my route I make the render of template. In template I have

<div class="winners col-md-5 col-sm-5 col-xs-5">
{{#data}}
    <div class="lineWinners">
        <h2><img src="{{ sImgWinners }}" alt=""><span>Liste:</span></h2>
        {{#each aWinners}}
            <div class="col-md-6 col-sm-6 details">
                <div class="col-md-3 col-sm-3 col-xs-3">
                    <img src="{{{ sImageUrl }}}" alt="{{ this.sGift }}">
                </div>
                <div class="col-md-9 col-sm-9 col-xs-9">
                    <p><strong>{{ this.sWinner }}</strong><br />{{ this.sGift }}</p>
                </div>
            </div>
        {{/each}}
    </div>
{{/data}}

The problem is that In the browser I get 3 times :

Liste:
Liste:
Liste:

and one {#each} {/each}, this is correct. So the idea is that content who is outside of each is duplicate 3 times. Can you help me please ? Thx in advance and sorry for my english I have a method

public function renderHandlebars($template,$data)
{
    $o_handlebars = new Handlebars();

    $o_template = $o_handlebars->loadTemplate($template);

    return $o_template->render($template, $data);
}
Harea Costicla
  • 797
  • 3
  • 9
  • 20

0 Answers0