backup du projet
This commit is contained in:
56
controllers/mother_controller.php
Normal file
56
controllers/mother_controller.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
use Smarty\Smarty;
|
||||
|
||||
|
||||
class MotherCtrl {
|
||||
|
||||
protected array $_arrData = array(); // ou = []
|
||||
|
||||
/**
|
||||
* Méthode d'affichage des pages
|
||||
*/
|
||||
protected function _display($strView, bool $boolDisplay = true){
|
||||
// Création de l'objet Smarty
|
||||
$objSmarty = new Smarty();
|
||||
// Ajouter le var_dump au modificateur de smarty : vardump est le nom appelé après le |
|
||||
$objSmarty->registerPlugin('modifier', 'vardump', 'var_dump');
|
||||
// Désactiver la mise en cache
|
||||
$objSmarty->caching = false;
|
||||
|
||||
// Forcer la recompilation des templates
|
||||
$objSmarty->force_compile = true;
|
||||
|
||||
// Vérifier si les templates ont été modifiés
|
||||
$objSmarty->compile_check = true;
|
||||
|
||||
// Récupérer les variables
|
||||
foreach($this->_arrData as $key=>$value){
|
||||
//$$key = $value;
|
||||
$objSmarty->assign($key, $value);
|
||||
}
|
||||
// Message de succès
|
||||
$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");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// inclusion du header
|
||||
/*include("views/_partial/header.php");
|
||||
include("views/".$strView.".php");
|
||||
include("views/_partial/footer.php");*/
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user