0
大きな問題があり、これを解決する方法がわかりません。 だから私は、ヘルパーのクラスている:今、私は私のテンプレートでPHPを使用してレンダリングハンドルバーのヘルパーを作成
class IfCondHelper implements HelperInterface
{
public function execute(Template $template, HandlebarsContent $context, $args, $source)
{
$parsed_args = $template->parseArguments($args);
if (count($parsed_args) != 3) {
throw new \InvalidArgumentException(
'"IfCond" helper expects exactly three arguments.'
);
}
switch ($context->get($parsed_args[1])) {
case "==":
return ($context->get($parsed_args[0]) == $context->get($parsed_args[2])) ? $source : false;
break;
..............
}
}
を:
{{#ifCond 2 '==' 2}} {{data.oUser.number}} {{/ifCond}}
問題は、テンプレートがdata.oUser.number
whitchの値が4で示すが表示されないということですコードdata.oUser.number
はそれらを解釈します。ヘルパーはうまくいきます。なぜなら、もし私がそうしているからです。
{{#ifCond 2 '==' 2}} <p>Test</p> {{/ifCond}}
これはうまくいきます。私を助けてくれますか?事前にTHXと私の英語