<?php
/**
 * Simple autoloader for Smarty
 * In production, use Composer instead
 */

// Smarty autoloader
spl_autoload_register(function ($class) {
    // Check if it's a Smarty class
    if (strpos($class, 'Smarty') === 0) {
        $file = __DIR__ . '/smarty/' . str_replace('\\', '/', $class) . '.php';
        if (file_exists($file)) {
            require_once $file;
            return true;
        }
        
        // Try in libs directory
        $file = __DIR__ . '/smarty/Smarty.class.php';
        if (file_exists($file)) {
            require_once $file;
            return true;
        }
    }
    return false;
});

// Fallback - require main Smarty file if exists
$smartyFile = __DIR__ . '/smarty/Smarty.class.php';
if (file_exists($smartyFile)) {
    require_once $smartyFile;
}
