davo Posted January 29, 2015 Share Posted January 29, 2015 I have a number of pages brought back in the array and I want to test to see if each any one of the pages in the array has a certain field with content. I could probably loop through the array but seem to remember if there was a simpler method. I've tried the below which doesn't work: $showcases = $pages->find("template=dmc_update_link, DMC_select=$pageid, parent=1209"); $countshowcases = count($showcases); if (($countshowcases > 0) && ($showcases->DMC_update_doc !=="")) { echo " <a data-toggle='collapse' data-parent='#accordion' href='#collapsefour' class='list-group-item active'><span class='glyphicon glyphicon-collapse-down'></span> Destination Showcases <span class='badge'>{$countshowcases}</span></a> <div id='collapsefour' class='panel-collapse collapse'> <div class='panel-body'>"; foreach ($showcases as $showcase) { echo "<li class='list-group-item'><a href='{$showcase->DMC_update_doc->url}' target='_blank'>Showcase {$showcase->title}</a> </li>"; } echo "</div></div>"; } Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 29, 2015 Share Posted January 29, 2015 How about this? "fieldName!=''" Link to comment Share on other sites More sharing options...
davo Posted January 30, 2015 Author Share Posted January 30, 2015 How about this? "fieldName!=''" where do you mean to express that? I can't get it to filter Link to comment Share on other sites More sharing options...
renobird Posted January 30, 2015 Share Posted January 30, 2015 I think LostKobrakai is suggesting you add that to your selector. That way your PageArray only containes pages where that field has some value. Optionally you could do: $showcases->filter("fieldname!=''"); 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