@extends('ui-theme.' . env('THEME_FOLDER') . '.layout.ui-main') @section('content') @php $breadcrumbType = 'without_image'; $page = null; $headerImage = asset('assets/images/breadcrumb-bg.jpg'); @endphp @php // Lightweight highlight + excerpt helper for search results if (!function_exists('search_snippet_highlight')) { function search_snippet_highlight($text, $query, $limit = 160) { $text = trim(strip_tags((string)($text ?? ''))); if ($text === '') return ''; // Skip obvious URLs/paths and file-like strings if (preg_match('/^https?:\/\//i', $text)) return ''; if (preg_match('~^data:[a-z]+\/[a-z0-9+.-]+;base64,~i', $text)) return ''; if (preg_match('~(^|/)((storage|uploads|files)(/|$))~iu', $text)) return ''; if (preg_match('~\.(?:jpe?g|png|gif|svg|webp|pdf|docx?|xlsx?|pptx?|mp4|mov|avi|zip|rar)(?:\?.*)?$~iu', $text)) return ''; $q = trim((string)($query ?? '')); if ($q === '') { return \Illuminate\Support\Str::limit($text, $limit); } // Tokenize query to highlight each word $tokens = array_values(array_filter(preg_split('/\s+/u', $q))); $anchor = $tokens[0] ?? $q; // Find best anchor position for centered excerpt $pos = mb_stripos($text, $anchor); if ($pos === false) { foreach ($tokens as $t) { $pos = mb_stripos($text, $t); if ($pos !== false) break; } } if ($pos === false) { // No match in this field; do not render a snippet return ''; } else { $start = max(0, $pos - (int)($limit / 2)); $snippet = mb_substr($text, $start, $limit); if ($start > 0) $snippet = '…' . ltrim($snippet); if ($start + $limit < mb_strlen($text)) $snippet = rtrim($snippet) . '…'; } // Build a case-insensitive pattern to wrap matches $escaped = array_map(fn($t) => preg_quote($t, '/'), $tokens); if (empty($escaped)) $escaped = [preg_quote($q, '/')]; $pattern = '/(' . implode('|', $escaped) . ')/iu'; $highlighted = preg_replace($pattern, '$1', $snippet); return $highlighted; } } @endphp
{{ $translations['searchresults_found'] ?? '' }} {{ $query }} {{ $translations['search.result.for'] ?? '' }} {{ $total }} {{ $translations['search.result.forend'] ?? '' }}
@if(($pages?->count() ?? 0) > 0)