Also nochmal für doofe wie mich:
<?php
const LAYOUT_HTML_FILE_PATH = 'layout.html';
const WIDGETS_FOLDER_PATH = 'widgets/';
include_once 'ImagesController.php';
$ImgCtrl = new ImagesController( './mediaordner/arbeit01/' );
$aImages = $ImgCtrl->ReadImagesData()->KeySort()->Get();
$_LayoutHtml = file_get_contents( LAYOUT_HTML_FILE_PATH );
$_FiguresHml = file_get_contents( WIDGETS_FOLDER_PATH . 'figures.html' );
$jFileContent = file_get_contents( 'datei.JSON' );
$jObject = json_decode( $jFileContent );
$_FiguresRendered = foreach ($aImages as $basename => $img)(
function ( $img ) use ( $_FiguresHml ) {
return strtr(
$_FiguresHml
, [
'{headline}' => $jObject -> $basename -> headline,
'{titel}' => $jObject -> $basename -> titel,
'{subtext}' => $jObject -> $basename -> subtext,
'{img.path}' => $img['path'],
'{img.width}' => $img['size']['width'],
'{img.height}' => $img['size']['height']
]
);
}
, $aImages
);
echo str_replace( '{figures}', implode($_FiguresRendered), $_LayoutHtml );
?>
Gruß T.