TYPO3 v9 has reached its end-of-life September 30th, 2021 and is not maintained by the community anymore. Looking for a stable version? Use the version switch on the top left.

You can order Extended Long Term Support (ELTS) here: TYPO3 ELTS.

Working With Collections

The \TYPO3\CMS\Core\Resource\ResourceFactory class provides a convenience method to retrieve a File Collection.

$resourceFactory = ResourceFactory::getInstance();
$collection = $resourceFactory->getCollectionObject(1);
// Load the contents of the collection

In this example, we retrieve and load the content from the File Collection with a uid of "1". Any Collection implements the \Iterator interface, which means that a Collection can be looped over (once its content has been loaded). Thus if the above code passed the $collection variable to a Fluid view, you could do the following:

        <f:for each="{collection}" as="file">