File "BaseController.php"

Full Path: C:/wamp64/www/Asistencia_Capacitacion/Controladores/BaseController.php
File size: 604 bytes
MIME-type: text/x-php
Charset: utf-8

<?php
// File: Controladores/BaseController.php

class BaseController {

    // Método para cargar una Vista (La V de MVC)
    protected function view($viewName, $data = []) {
        extract($data); 
        $viewPath = 'Vistas/' . $viewName . '.php';

        if (file_exists($viewPath)) {
            require_once $viewPath;
        } else {
            die("Error: La vista '{$viewName}' no existe en {$viewPath}");
        }
    }

    // Método para manejar redirecciones
    protected function redirect($path) {
        header('Location: ' . $path);
        exit();
    }
}