How can I assign variable in .tpl?
-
You can't assign variables in benchpress templates. You'll have to inline the value instead:
<div ...> {{{ each children }}} {{{ if (cid == children.y) }}} <div ...> </div> {{{ end }}} {{{ end }}} </div>
See the benchpressjs docs for more info:
benchpressjs/docs at master · benchpressjs/benchpressjs
ultralight javascript templating framework. Contribute to benchpressjs/benchpressjs development by creating an account on GitHub.
GitHub (github.com)
-
@PitaJ Actually, I need double loop.
{{{ each ../children }}} x = ../cid {{{ each leaves }}} {{{ if x == leaves.yy }}} (L4) {{{ end }}} {{{ end }}} {{{ end }}}
If I write '../cid' instead of 'x' at L4, ../cid is cid of leaves not of children.
Do you know any solution? -
@ghdms
../../cid
Copyright © 2024 NodeBB | Contributors