<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
        http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">

    <!-- ========================================== -->
    <!-- STATIC PAGES -->
    <!-- ========================================== -->
    
    <url>
        <loc>https://learnaticinstitute.com/</loc>
        <lastmod>2024-01-15</lastmod>
        <changefreq>daily</changefreq>
        <priority>1.0</priority>
    </url>
    
    <url>
        <loc>https://learnaticinstitute.com/about.php</loc>
        <lastmod>2024-01-15</lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.8</priority>
    </url>
    
    <url>
        <loc>https://learnaticinstitute.com/courses.php</loc>
        <lastmod>2024-01-15</lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.9</priority>
    </url>
    
    <url>
        <loc>https://learnaticinstitute.com/admission.php</loc>
        <lastmod>2024-01-15</lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.8</priority>
    </url>
    
    <url>
        <loc>https://learnaticinstitute.com/demo-class.php</loc>
        <lastmod>2024-01-15</lastmod>
        <changefreq>weekly</changefreq>
        <priority>0.7</priority>
    </url>
    
    <url>
        <loc>https://learnaticinstitute.com/contact.php</loc>
        <lastmod>2024-01-15</lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.8</priority>
    </url>
    
    <url>
        <loc>https://learnaticinstitute.com/campuses.php</loc>
        <lastmod>2024-01-15</lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.7</priority>
    </url>
    
    <url>
        <loc>https://learnaticinstitute.com/privacy-policy.php</loc>
        <lastmod>2024-01-15</lastmod>
        <changefreq>yearly</changefreq>
        <priority>0.3</priority>
    </url>
    
    <url>
        <loc>https://learnaticinstitute.com/terms-conditions.php</loc>
        <lastmod>2024-01-15</lastmod>
        <changefreq>yearly</changefreq>
        <priority>0.3</priority>
    </url>

    <!-- ========================================== -->
    <!-- DYNAMIC COURSE PAGES (FROM DATABASE) -->
    <!-- ========================================== -->
    <?php
    require_once 'config/database.php';
    
    try {
        $stmt = $pdo->query("SELECT slug, updated_at FROM courses WHERE status = 1 ORDER BY id ASC");
        $courses = $stmt->fetchAll();
        
        foreach ($courses as $course) {
            $lastmod = date('Y-m-d', strtotime($course['updated_at']));
            echo '<url>';
            echo '<loc>https://learnaticinstitute.com/course-detail.php?slug=' . $course['slug'] . '</loc>';
            echo '<lastmod>' . $lastmod . '</lastmod>';
            echo '<changefreq>weekly</changefreq>';
            echo '<priority>0.8</priority>';
            echo '</url>';
        }
    } catch (PDOException $e) {
        // Skip if database fails
    }
    ?>

</urlset>