a-ok Posted May 17, 2017 Share Posted May 17, 2017 Is there a way to do this as one selector? The below obviously doesn't work but wondered if something similar is possible? $archives = $pages->find("template=ab-archive-detail"); foreach ($archives->ab_archive_archives as $archive) : I'm trying to loop through the image field ab_archive_archives on each of the pages with the template ab-archive-detail as one selector... Thanks! Link to comment Share on other sites More sharing options...
bernhard Posted May 19, 2017 Share Posted May 19, 2017 I don't understand your question and maybe the others didn't as well because there is no answer so far... You cannot loop over an image field. You can loop over a pagearray and that's what you are doing. And you already have only one selector... Maybe you can use ->each() but that's quite the same, only shorter.. Link to comment Share on other sites More sharing options...
kongondo Posted May 19, 2017 Share Posted May 19, 2017 1 hour ago, bernhard said: You cannot loop over an image field. Uh? Typo...? http://processwire.com/api/fieldtypes/images/ 1 Link to comment Share on other sites More sharing options...
bernhard Posted May 20, 2017 Share Posted May 20, 2017 On 17.5.2017 at 0:51 PM, oma said: The below obviously doesn't work i didn't realize this part of his message and so i was totally confused by the posting of course you can loop over the returned array of images but not over the FIELD in a setup like he posted ( like $pagearray->fieldname ) maybe some selectors like this would be possible in your case? @oma Link to comment Share on other sites More sharing options...
a-ok Posted May 22, 2017 Author Share Posted May 22, 2017 Hi folks, Thanks for the replies and apologies for not getting back sooner. I meant exactly as bernhard described... looping over the FIELD in a $pages->find selector. Not to worry... thought it was a long shot! Thanks for all the help. 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