namespace de fait hehe

This commit is contained in:
Yasder5 2026-02-28 15:57:54 +01:00
parent 6c21a5f1cb
commit 0638834933
23 changed files with 131 additions and 81 deletions

View file

@ -0,0 +1,47 @@
<?php
namespace Controllers;
use Smarty\Smarty;
/**
* Le controller de la partie accessible uniquement par l'admin
* @author Yasser
*/
class MotherCtrl {
protected array $_arrData = array(); // ou = []
/**
* Méthode d'affichage des pages
*/
protected function _display($strView, bool $boolDisplay = true){
$objSmarty = new Smarty();
$objSmarty->registerPlugin('modifier', 'vardump', 'var_dump');
$objSmarty->caching = false;
$objSmarty->force_compile = true;
$objSmarty->compile_check = true;
foreach($this->_arrData as $key=>$value){
$objSmarty->assign($key, $value);
}
$objSmarty->assign("success_message", $_SESSION['success']??'');
unset($_SESSION['success']);
if (isset($_SESSION['error'])){
$objSmarty->assign("arrError", array($_SESSION['error']));
unset($_SESSION['error']);
}
if ($boolDisplay){
$objSmarty->display("views/".$strView.".tpl");
}else{
return $objSmarty->fetch("views/".$strView.".tpl");
}
}
}