PHPSpert Posted March 13, 2013 Share Posted March 13, 2013 This is driving me crazy. I have a variable $course_page which is a repeater. I'm trying to get the next entry in the repeater. How? I've tried getNext(), next() and next. Link to comment Share on other sites More sharing options...
Joss Posted March 13, 2013 Share Posted March 13, 2013 You can either loop through them or grab them by index - $repeater->fieldname->eq(3) ... etc Looping would be just using foreach as with any other array in PW. $myrepeater = $page->course_page; foreach($myrepeater as $course){ echo $course->fieldname; } Link to comment Share on other sites More sharing options...
diogo Posted March 13, 2013 Share Posted March 13, 2013 the value of a repeater is pageArray, so getNext() should work. What value are you using as the parameter? Edit: Ok, quickly tested, and everything works as expected. I will post here my test so you can analyze and make sure that you are using it the right way: $repeaterArray = $page->repeater; $firstElement = $repeaterArray->first(); echo $repeaterArray->getNext($firstElement); //returns successfully the second element echo $firstElement->next(); //also returns the second element 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now