header menu condtion

Created: May 7, 2025 at 12:16 pm

Expires: Never

Syntax: HTML

$current_page = basename($_SERVER['PHP_SELF']);
if ($current_page === 'details.php') {
    $meta_title = sanitize($casting['title']);
    $meta_description = nl2br(sanitize($casting['description']));
    $meta_description = strip_tags($raw_description);
    // Replace multiple spaces, tabs, newlines with a single space
    $meta_description = preg_replace('/\s+/', ' ', $meta_description);
    // Trim to remove leading/trailing whitespace
    $meta_description = trim($meta_description);
    // Optional: limit to 160 characters
    $meta_desc = substr($meta_description, 0, 160);
}else{
    $meta_title = "SEO STATIC TITLE";
    $meta_desc = "SEO STATIC DESC";
}