Bonjour tout le monde !

Bienvenue sur WordPress. Ceci est votre premier article. Modifiez-le ou supprimez-le, puis commencez à écrire !

<?php
require_once __DIR__ . '/libs/Smarty/Smarty.class.php';

$config = include __DIR__ . '/config.php';
$smarty = new Smarty();
$smarty->setTemplateDir(__DIR__ . '/templates/');
$smarty->setCompileDir(__DIR__ . '/templates_c/');

$sections = [];
foreach (glob($config['sections_path'] . '/*', GLOB_ONLYDIR) as $dir) {
    $sectionName = basename($dir);
    $sectionConfig = include $dir . '/config.php';
    $sections[$sectionName] = $sectionConfig;
}

$current = $_GET['section'] ?? 'VARIABLES';
$pageFile = "{$config['sections_path']}/{$current}/page.tpl";
if (!file_exists($pageFile)) {
    $pageFile = "{$config['sections_path']}/VARIABLES/page.tpl";
}

$smarty->assign('config', $config);
$smarty->assign('sections', $sections);
$smarty->assign('current', $current);
$smarty->assign('page_tpl', $pageFile);
$smarty->display('layout.tpl');

1 réflexion sur “Bonjour tout le monde !”

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Retour en haut