@pasib when you concatenated the object, it got stringified.
Try console.log('test', postData); 🙂
Theare are some method or label to get the index of for?
I have in my tpl page this :
<!-- BEGIN posts -->
<!-- END posts -->
I want to get current index. Anyone can help me?
According to the code it's @ index
(or @key
for objects).
EDIT: without spaces, NodeBB bug detected xD
EDIT2: bug reported gh#4426
@frissdiegurke for example I create this label:
<!-- BEGIN posts -->
<label for="text">TEXT @ index</label>
<!-- END posts -->
And I print "TEXT 0", "TEXT 1"... so it's work but I need to start from "TEXT 1" not from "TEXT 0". I try this but it's not work:
<label for="text">TEXT @ index+1</label>
Can you suggest me the solution?
Syntax seems strange to me.
<!-- BEGIN posts -->
@ index
<!-- END posts -->
works
but it should be something like
<!-- BEGIN posts -->
{[email protected] index}
<!-- END posts -->
I try also
<label for="text">TEXT (@ index +1)</label>
But it doesn't work!
@Doppy consider using code blocks when you post code... will be easier to read
Calculations/Evaluations are not part of the lightweight template engine NodeBB uses. (AFAIK)
I guess the best would be to intercept the filter:post.getPosts
hook and add your custom index values...