@php
// Count total marketing initiatives from BOTH arrays
$marketingCount = count($ArrlistingArticlespinitsponser ?? []) + count($ArrlistingArticlespinitsponser2 ?? []);
// Defaults
$boxHeight = '500px';
$showAd = false;
switch ($marketingCount) {
case 0:
$boxHeight = '525px';
$showAd = true;
break;
case 1:
$boxHeight = '660px';
break;
case 2:
$boxHeight = '580px';
break;
case 3:
$boxHeight = '460px';
break;
default:
$boxHeight = '420px';
break;
}
@endphp
{{-- ===================== LATEST NEWS ===================== --}}
{{-- ===================== MARKETING INITIATIVE 1===================== --}}
@if (count($ArrlistingArticlespinitsponser) > 0)
@php
$label = trim($ArrlistingArticlespinitsponser[0]->name ?? '');
$words = preg_split('/\s+/', $label, 2);
@endphp
{{ $words[0] ?? '' }}
@if (!empty($words[1]))
{{ $words[1] }}
@endif
@foreach ($ArrlistingArticlespinitsponser as $sp)
@endforeach
@endif
{{-- ===================== MARKETING INITIATIVE 2===================== --}}
@if (count($ArrlistingArticlespinitsponser2) > 0)
@php
$label = trim($ArrlistingArticlespinitsponser2[0]->name ?? '');
$words = preg_split('/\s+/', $label, 2);
@endphp
{{ $words[0] ?? '' }}
@if (!empty($words[1]))
{{ $words[1] }}
@endif
@foreach ($ArrlistingArticlespinitsponser2 as $sp)
@endforeach
@endif
{{-- ===================== BANNER ===================== --}}
@if ($showAd && isset($parents[6]))
@if ($parents[6]->status == 1 && $parents[6]->desktop == 1)
{!! $parents[6]->bscript !!}
@endif
@endif