Implement dynamic template rendering and page observer: Enhanced PageController to support dynamic header and footer templates, utilizing TemplateService for placeholder replacement. Introduced PageObserver to manage homepage status across pages. Updated routes for improved debugging and dynamic homepage display. Refactored views to accommodate new templating system.
This commit is contained in:
@@ -1,8 +1,27 @@
|
||||
@extends('layouts.site')
|
||||
|
||||
@section('content')
|
||||
@php $blocks = $sections ?? []; @endphp
|
||||
@if(is_array($blocks) && !empty($blocks))
|
||||
@php
|
||||
// Yeni dinamik template sistemi - Öncelik verilir
|
||||
$hasTemplatedSections = isset($templatedSections) && $templatedSections->isNotEmpty();
|
||||
|
||||
// Eski section builder sistemi
|
||||
$blocks = $sections ?? [];
|
||||
$hasBlocks = is_array($blocks) && !empty($blocks);
|
||||
@endphp
|
||||
|
||||
@if($hasTemplatedSections)
|
||||
{{-- Yeni dinamik template sisteminden gelen sections --}}
|
||||
@foreach($templatedSections as $section)
|
||||
@if($section['template'] ?? null)
|
||||
{!! \App\Services\TemplateService::replacePlaceholders(
|
||||
$section['template']->html_content,
|
||||
$section['data'] ?? []
|
||||
) !!}
|
||||
@endif
|
||||
@endforeach
|
||||
@elseif($hasBlocks)
|
||||
{{-- Eski blok bazlı dinamik render --}}
|
||||
@foreach($blocks as $block)
|
||||
@php $type = $block['type'] ?? null; @endphp
|
||||
@if($type && view()->exists("components.blocks.$type"))
|
||||
|
||||
Reference in New Issue
Block a user