nabo Posted April 19, 2018 Share Posted April 19, 2018 Hi $exhibitions = new PageArray(); foreach ($events as $event) { foreach ($event->event_exhibition as $exhibition) { $exhibitions->append($exhibition); } } $exhibitions->sort("event_first_date"); each event use repeaters for exhibitions. I need to print all exhibitions but at the same time I need the title of the event... I tried $exhibition->parent->title.... but it's not working Link to comment Share on other sites More sharing options...
bernhard Posted April 19, 2018 Share Posted April 19, 2018 $exhibitions->append($exhibition->getForpage()); 3 Link to comment Share on other sites More sharing options...
nabo Posted April 20, 2018 Author Share Posted April 20, 2018 Sorry, maybe I was not too clear... $exhibitions = new PageArray(); foreach ($events as $event) { foreach ($event->event_exhibition as $exhibition) { $exhibitions->append($exhibition); } } $exhibitions->sort("event_first_date"); foreach ($exhibitions as $exhibition) { echo $exhibition->parent->title; } This change $exhibitions->append($exhibition->getForpage()); doesn't work. I think "parent" works for page but not for repeater Link to comment Share on other sites More sharing options...
bernhard Posted April 20, 2018 Share Posted April 20, 2018 Of course it works. getForpage() returns the page where the repeater item lives. your code snippet was not clear to me, so you might use it differently, but using getForpage() is the key. You didn't provide any information of what your code does, which variables are what kind of data (pages, repeater items) etc.; Also you didn't provide information what you did exactly (where you placed my code) and what did not work. "doesn't work" is not a lot of information... 10 minutes ago, nabo said: I think "parent" works for page but not for repeater Yes, that's correct and totally makes sense, since it is a repeater item and not a page with a parent page. 2 Link to comment Share on other sites More sharing options...
nabo Posted April 20, 2018 Author Share Posted April 20, 2018 Hi Bernhard and thanks for your attention. I used your tip in a bad way... now it works 1 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