'ຄຳສອນພຸດທະ - ຮຽນຮູ້ພຣະສູດ ແລະ ທັມມະ', 'description' => 'ເວັບໄຊທ໌ສຳລັບຮຽນຮູ້ພຣະສູດ ພຣະທັມ ຄຳສອນຂອງພຣະພຸດທະເຈົ້າ ພ້ອມທັງປຶ້ມ, ວິດີໂອ ແລະ ປະຕິທິນກິດຈະກຳ', 'keywords' => 'ຄຳສອນພຸດທະ, ພຸດທະສາສະໜາ, ພຣະສູດ, ທັມມະ, ທັມ, ຮຽນຮູ້ພຸດທະ', 'image' => absoluteUrl('assets/images/logo_shared.png'), 'canonical' => canonicalUrl(), 'json_ld' => null, 'robots' => 'index, follow, max-snippet:-1, max-image-preview:large', ], $data['seo'] ?? []); $data['seo'] = $seo; extract($data); $viewFile = __DIR__ . "/../../views/" . str_replace('.', '/', $path) . ".php"; ob_start(); if (file_exists($viewFile)) { require $viewFile; } else { echo "View file not found: $viewFile"; } $content = ob_get_clean(); ob_start(); require __DIR__ . "/../../views/layouts/main.php"; $html = ob_get_clean(); if ($isProduction) { $html = minifyHtml($html); } echo $html; } function url($path = '/') { $scriptName = $_SERVER['SCRIPT_NAME']; $basePath = dirname($scriptName); if ($basePath === DIRECTORY_SEPARATOR) $basePath = ''; return $basePath . '/' . ltrim($path, '/'); } function minifyHtml($html) { $html = preg_replace('//s', '', $html); $parts = preg_split('/(]*>|<\/script>)/s', $html, -1, PREG_SPLIT_DELIM_CAPTURE); $depth = 0; foreach ($parts as $i => $part) { if (preg_match('/^]*>/i', $part)) { $depth++; continue; } if ($part === '') { $depth--; continue; } if ($depth > 0) continue; $min = preg_replace('/\s{2,}/', ' ', $part); $min = preg_replace('/> <', $min); $min = str_replace(["\r\n", "\r", "\n", "\t"], '', $min); $parts[$i] = trim($min); } return implode('', $parts); }