# SureCertificate - Course Variable Mapping
## 3-Step Initialization: Step 3 - Variable Extraction Plan

---

## 📊 SAMPLE ANALYSIS: 3 Course Pages Scanned

### Page 1: `advanced-certified-scrum-product-owner-training.php`
**Location:** `agile-management/`
**File Size:** 196,724 bytes (minified HTML)
**Structure Type:** KnowledgeHut-style exported page

#### Extracted Variables:
| Variable | Value | Extraction Method |
|----------|-------|-------------------|
| `title` | "ACSPO Certification Training" | `<h1>` inside breadcrumbs |
| `full_title` | "Advanced Certified Scrum Product Owner Training" | Breadcrumb last item |
| `category` | "Agile Management" | Breadcrumb level 2 |
| `category_url` | "../agile-management.php" | Breadcrumb link |
| `subtitle` | "Master the Skills to Drive Product Success as a Certified Scrum Product Owner" | Hero subtitle |
| `duration` | "24 Hours" | Hero features list |
| `enrolled` | "125,430+" | "Enrolled" badge text |
| `rating_google` | 4.8 | Rating div |
| `rating_facebook` | 4.7 | Rating div |
| `features` | Array of 3 items | `<li>` elements with checkmarks |
| `hero_image` | Unsplash URL with ID | `src` of hero img tag |
| `accreditation` | Scrum Alliance logo | Badge in hero section |
| `prerequisites` | Array of 3 items | Prerequisites section `<li>` |
| `highlights` | Array of 6 items | Course Highlights grid |
| `syllabus` | Array of 5 modules | Accordion items |
| `price_current` | "$1,299" | Pricing card |
| `price_original` | "$1,699" | Strikethrough price |
| `price_discount` | "24% OFF" | Discount badge |
| `faqs` | Array of 6 Q&A | FAQ section |

---

### Page 2: `itil-foundation-certification-training.php`
**Location:** `it-service-management/`
**File Size:** 3101 lines
**Structure Type:** Clean HTML with sections

#### Extracted Variables:
| Variable | Value | Extraction Method |
|----------|-------|-------------------|
| `title` | "ITIL Foundation Certification Training" | `<h1>` |
| `full_title` | "ITIL®4 Foundation Training" | Hero title |
| `category` | "IT Service Management" | Breadcrumb |
| `category_url` | "../itsm-certifications.php" | Breadcrumb link |
| `subtitle` | "The Ultimate Program to Master The New ITIL and Ace the Foundation Exam" | Hero subtitle |
| `duration` | "16 Hours" | Stats/features |
| `enrolled` | "120,750+" | "Enrolled" badge |
| `rating_google` | 4.8 | Rating div |
| `rating_facebook` | 4.7 | Rating div |
| `rating_switchup` | 4.9 | Rating div |
| `features` | Array of 3 items | `<ul class="CertTheme__ul">` |
| `hero_image` | Unsplash photo-1535905557-58cb6c7a44aa | Hero img src |
| `accreditation` | PeopleCert ATO badge | Logo + "Accredited Training Organization" |
| `prerequisites` | Array of 3 items | Prerequisites section |
| `highlights` | Array of 6 items | Grid with icons (users, certificate, clock, etc.) |
| `syllabus` | Not clearly defined | Hidden in long content |
| `price` | Not visible in sample | May need separate extraction |
| `faqs` | Present | FAQ section with toggles |

---

### Page 3: `devops-training.php`
**Location:** `devops/`
**File Size:** 213,514 bytes (minified HTML)
**Structure Type:** KnowledgeHut-style exported page

#### Extracted Variables:
| Variable | Value | Extraction Method |
|----------|-------|-------------------|
| `title` | "DevOps Certification Training" | `<h1>` |
| `full_title` | "DevOps Training" | Breadcrumb/Hero |
| `category` | "DevOps" | Breadcrumb level 2 |
| `category_url` | "../devops-courses.php" | Breadcrumb link |
| `subtitle` | "Comprehensive DevOps training to master CI/CD, automation, and cloud-native deployment" | Hero subtitle |
| `duration` | "35 Hours" | Features list |
| `enrolled` | "98,500+" | Enrolled badge |
| `rating_google` | 4.8 | Rating div |
| `rating_facebook` | 4.7 | Rating div |
| `features` | Array of 3-4 items | Hero feature list |
| `hero_image` | Unsplash URL | Hero section img |
| `accreditation` | Various badges | AWS/Docker/Kubernetes icons |
| `prerequisites` | Array | Prerequisites section |
| `highlights` | Array of 6-8 items | Tools coverage (Jenkins, Docker, K8s, etc.) |
| `syllabus` | Array of modules | Accordion section |
| `price` | Varies by region | Pricing card |
| `faqs` | Array | FAQ section |

---

## 🎯 UNIFIED VARIABLE SCHEMA

### Required Variables (All Pages Must Have):
```php
$courseData = [
    // Identity
    'title'              => (string)  // H1 title - e.g., "ITIL Foundation Certification Training"
    'subtitle'           => (string)  // Hero subtitle/tagline
    'category'           => (string)  // Category name - e.g., "IT Service Management"
    'category_url'       => (string)  // Link to category page
    
    // Meta
    'meta_description'   => (string)  // SEO description (optional, falls back to subtitle)
    
    // Hero Stats
    'duration'           => (string)  // e.g., "16 Hours", "35 Hours"
    'enrolled'           => (string)  // e.g., "120,750+"
    'rating'             => (array)   // ['google' => 4.8, 'facebook' => 4.7]
    
    // Content
    'features'           => (array)   // Array of 3-4 feature strings
    'hero_image'         => (string)  // Image URL (with fallback)
    'accreditation'      => (array)   // ['logo' => url, 'text' => 'Accredited Training Org']
    
    // Sections
    'prerequisites'      => (array)   // Array of prerequisite strings
    'highlights'         => (array)   // Array of ['icon' => 'users', 'text' => '<strong>16 Hours</strong>...']
    'syllabus'           => (array)   // Array of ['title' => 'Module 1', 'items' => [...]]
    'faqs'               => (array)   // Array of ['q' => '...', 'a' => '...']
    
    // Pricing (optional - can use defaults)
    'price'              => (array)   // ['current' => '$999', 'original' => '$1299', 'discount' => '23% OFF']
    
    // Reviews (optional)
    'reviews'            => (array)   // Array of ['name' => '...', 'role' => '...', 'rating' => 5, 'text' => '...']
];
```

---

## 🔧 EXTRACTION STRATEGY

### For Minified/Scraped Pages (like agile-management/ files):
1. **Regex Pattern Matching:**
   - Title: `<h1[^>]*>([^<]+)<\/h1>`
   - Breadcrumbs: `<ol[^>]*BreadcrumbList[^>]*>(.+?)<\/ol>`
   - Features: `<li[^>]*class="CertTheme__listItem[^>]*>([^<]+)<\/li>`
   - Ratings: `Google[^>]*>\s*([0-9.]+)`

2. **DOM Parsing (if PHP SimpleHTMLDom available):**
   - Parse with `DOMDocument` + `DOMXpath`
   - Extract by class names: `CertTheme__textBold`, `banner-list-new`, etc.

### For Clean Pages (like ITIL file):
1. **Direct Section Mapping:**
   - Sections have `data-id` attributes: `data-id="Prerequisites"`, `data-id="Course Highlights"`
   - Grid classes: `grid-cols-1 md:grid-cols-3`
   - Accordion classes: `transition-all duration-1000`

---

## 📝 SAMPLE CONVERSION

### Before (Old Messy HTML):
```php
<?php include __DIR__ . '/../header.php'; ?>
<div><section class="py-spacing44 sm:py-spacing48 xl:px-spacing80...">
  <!-- 200KB of minified HTML -->
</section></div>
<?php include __DIR__ . '/../footer.php'; ?>
```

### After (Using Master Template):
```php
<?php
$courseData = [
    'title' => 'ITIL Foundation Certification Training',
    'subtitle' => 'The Ultimate Program to Master The New ITIL and Ace the Foundation Exam',
    'category' => 'IT Service Management',
    'category_url' => '../itsm-certifications.php',
    'duration' => '16 Hours',
    'enrolled' => '120,750+',
    'rating' => ['google' => 4.8, 'facebook' => 4.7],
    'features' => [
        "World's #1 ITIL Certification Exam Prep designed to help you pass on your first attempt.",
        "Kickstart your ITSM career with 16 hours of live ITIL Foundation V4 certification training.",
        "Learn how to deliver value across the full lifecycle in today's complex, AI-enabled environments."
    ],
    'hero_image' => 'https://images.unsplash.com/photo-1535905557-58cb6c7a44aa?w=1000',
    'accreditation' => [
        'logo' => 'https://d2o2utebsixu4k.cloudfront.net/ITIL Logo_Circle_New-cb9ee79dbbb0445086d706eb2ba0ce02.svg',
        'text' => 'Accredited Training Organization'
    ],
    'prerequisites' => [
        'No specific prerequisites or prior qualifications required',
        'Suitable for beginners and experienced professionals alike',
        'Basic understanding of IT terminology is beneficial'
    ],
    'highlights' => [
        ['icon' => 'users', 'text' => '<strong>16 Hours</strong> of Live Instructor-Led Sessions'],
        ['icon' => 'certificate', 'text' => '<strong>Earn 16 PDUs</strong> for Continued Learning'],
        ['icon' => 'clock', 'text' => '<strong>Flexible</strong> Weekend & Weekday Batches'],
        ['icon' => 'headset', 'text' => '<strong>24/7 Support</strong> & Learning Assistance'],
        ['icon' => 'file-alt', 'text' => '<strong>Official</strong> Course Materials Included'],
        ['icon' => 'award', 'text' => '<strong>Exam</strong> Preparation & Mock Tests']
    ],
    'price' => [
        'current' => '$899',
        'original' => '$1,199',
        'discount' => '25% OFF'
    ],
    'syllabus' => [
        ['title' => 'Module 1: ITIL 4 Foundation Introduction', 
         'items' => ['Key Concepts of Service Management', 'The Four Dimensions of Service Management']],
        ['title' => 'Module 2: ITIL Guiding Principles',
         'items' => ['Focus on Value', 'Start Where You Are', 'Progress Iteratively']],
        ['title' => 'Module 3: Service Value System',
         'items' => ['The Service Value Chain', 'ITIL Practices Overview']],
    ],
    'faqs' => [
        ['q' => 'What is ITIL 4 Foundation certification?', 
         'a' => 'ITIL 4 Foundation is the entry-level certification...'],
        ['q' => 'How long is the ITIL 4 Foundation exam?',
         'a' => 'The exam is 60 minutes with 40 multiple-choice questions.']
    ]
];
include __DIR__ . '/../course-template.php';
```

---

## 🚀 NEXT STEPS FOR APPROVAL

Once you confirm this variable mapping, I will:

1. **Create an extraction script** (`extract-course-data.php`) that:
   - Reads each course page
   - Extracts data using the schema above
   - Generates new clean files using `course-template.php`

2. **Batch process priority pages** (highest traffic first):
   - ITIL Foundation
   - PMP Certification
   - AWS/DevOps courses
   - Agile/Scrum certifications

3. **Verification phase**:
   - Compare rendered output before/after
   - Ensure zero broken images
   - Validate all paths work with BASE_URL

---

## ✅ CONFIRMATION REQUIRED

**Please confirm:**
1. Does the variable schema cover all your course page elements?
2. Should I proceed with creating the extraction script?
3. Which 10-20 pages should I prioritize for the first batch conversion?

**Estimated Timeline:**
- Extraction Script: 30 minutes
- First 10 Pages: 1 hour
- Full Site (2954 pages): 4-6 hours (automated batch processing)
