imlemented step 16 by Gemini

- Template
This commit is contained in:
2026-06-15 04:38:05 +02:00
parent 7efd6b24a5
commit d350daa1d8
11 changed files with 302 additions and 10 deletions

View File

@ -6,6 +6,8 @@ namespace App\Services;
use Exception;
require_once __DIR__ . '/../Utils/Helpers.php';
class Renderer
{
private FileStorage $storage;
@ -41,13 +43,27 @@ class Renderer
$siteCssSource = $this->templatesPath . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'site.css';
copy($siteCssSource, $assetsDir . DIRECTORY_SEPARATOR . 'site.css');
// 3. Render HTML
// 3. Render Content Sections
$sectionsHtml = '';
$selectedSections = $projectData['wizard_data']['modules']['sections'] ?? [];
foreach ($selectedSections as $sectionId) {
try {
$sectionsHtml .= $this->renderTemplate("sections/{$sectionId}", [
'project' => $projectData
]);
} catch (Exception $e) {
error_log("Renderer: Failed to render section $sectionId: " . $e->getMessage());
}
}
// 4. Render HTML base template
$html = $this->renderTemplate('base', [
'project' => $projectData,
'content' => '<!-- Final content sections will go here -->'
'content' => $sectionsHtml
]);
// 4. Save to exports
// 5. Save to exports
return file_put_contents($projectExportDir . DIRECTORY_SEPARATOR . 'index.html', $html) !== false;
}