oma

Loop through an image field on various pages as one selector

Recommended Posts

oma    42

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!

Share this post


Link to post
Share on other sites
bernhard    1,289

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..

Share this post


Link to post
Share on other sites
bernhard    1,289
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

 

Share this post


Link to post
Share on other sites
oma    42

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.