Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

$Iterator doesn't work


Reply

2 Posts   1444 Views

Avatar
Moose

16 April 2009 at 9:28pm Community Member, 26 Posts

Hi

I need to access the numerical index in a control loop. I was thrilled to find the following
"you can use $Iterator inside a control-block to access the numerical index of the current item".

Unfortunately I get the following error when I try use $Iterator in a 'control children' structure:
Fatal error: Call to undefined method ViewableData_Iterator::forTemplate()

Any ideas?

Thanks!

Avatar
Moose

16 April 2009 at 9:41pm Community Member, 26 Posts

The article that I found was incorrect - I see that the correct method is $pos. I'll respond to the article.