Structured field attr from multiple pages

I need to collect, on a single page, one of the values / attributes of a structured field present on different pages (and, in a near future, from different templates). How to proceed ?

Could you be a bit more specific? Only one item of each structure, or all values of all items of multiple pages from a specific field in the structure, for example, if you have a structure field with a field email, then all emails entries from all items from multiple pages?

Hi, Mark,

thanks for reacting. See below.

Hi, Texnixe

sorry if I was not.
The structure is :


I need to collect, on a single page, the attributes “title” and the “url” of the “Externals” of all the pages of the site which have the youtube “url”.

I’d probably merge all structure fields into one structure collection, then filter by url. Unlesss the URL is always a youtube url.

Or look through all pages with such a field, the convert field into structure , filter the structure and output the result for each page individually.

Sorry for silence, Texnixe.
Haven’t found better then :

<?php foreach($site->index()->filterby('xxx', 'yyy') as $videos): ?>
<?php if($videos->structuredfield()->tostructure()->isnotempty()): ?>
<?php foreach($videos->structuredfield()->tostructure() as $video): ?>
	<!-- do the stuff -->

Coding tip: Always store code you need to repeat in a variable:

<?php $videoStructure = $videos->structuredfield()->tostructure(); ?>
<?php if($videoStructure->isnotempty()): ?>
<?php foreach($videoStructure as $video): ?>

I thought you needed to filter the structure fields themselves, not the parent pages. Your code is fine like that.

noted! :face_with_monocle: