getAllBrands(); $brandMap = array(); foreach ($brands as $brand) { $geometryService = new GeometryService(); $geometries = $geometryService->getAllRoadGeometriesByBrand($brand->id); foreach ($geometries as $geometry) { $modelService = new ModelService(); $brandMap[$brand->name][$geometry->name]['models'] = $modelService->getAllModelsByGeometry($geometry->id); $frameService = new FrameService(); $frames = $frameService->getAllFramesByGeometry($geometry->id); if ($frames === null) { header('location:add_frame.php');} foreach ($frames as $frame) { $brandMap[$brand->name][$geometry->name]['geometries'][] = $frame; } } } $smarty = new Smarty; $smarty->assign('brandMap', $brandMap); $smarty->display('views/index.tpl'); } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } ?>