. */ function render_component(string $componentPath): string { ob_start(); include($componentPath); return ob_get_clean(); } function template_process(string $template, array $components = []): string { $html = file_get_contents($template); foreach ($components as $placeholder => $componentPath) { $injectedContent = render_component($componentPath); $html = str_replace($placeholder, $injectedContent, $html); } return $html; } ?>