Foreach does not initialise column field (@rowstart is undefined)

I’m trying to use the @rowstart in foreach, but the if block never triggers. I would expect the below to print the first post in each column, but every post triggers the “else” clause, printing ‘nope’. I tried printing {{@rowstart}} in the loop, and it’s blank every iteration. Other @-values such as @even print true/false correctly.

{{#foreach posts columns="3"}}
  {{#if @rowstart}}
    {{>post-card }}
  {{else}} nope

I may be misreading the code, but in the source for the helper, it doesn’t look like the column field is ever parsed from the input. I can see limit, from and to are all parsed at lines 54-56, but columns seems to stay at the initialisation value.

Can you check if @rowStart (capital S) works?

1 Like

OMG, yes, thank you, @rowStart works.

I can’t believe I spent so long staring at the doc example trying to figure out what I was doing wrong and totally missed the capital letter the whole time. :person_facepalming: Thank you.