www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 3e62897e668032d1858e8e44a8d71239ff00a4ff
parent 3e101d22be767bf4a5b46921086f689d1ec0d89f
Author: Georges Dupéron <jahvascriptmaniac+github@free.fr>
Date:   Thu,  8 Jul 2010 03:41:36 +0200

Déplacement de l'en-tête et du pied de page vers squelette.

Diffstat:
M__cms__/cms.php | 33++-------------------------------
M__cms__/controleur/page.php | 6+++---
A__cms__/squelette.php | 37+++++++++++++++++++++++++++++++++++++
3 files changed, 42 insertions(+), 34 deletions(-)

diff --git a/__cms__/cms.php b/__cms__/cms.php @@ -3,18 +3,11 @@ // Tous les chemins pour les include sont relatifs à __cms__ . chdir(dirname(__FILE__)); -require_once("util.php"); -require_once("path.php"); require_once("controleur/page.php"); -require_once("types/galerie.php"); -require_once("types/galerie-periode.php"); -require_once("types/galerie-evenement.php"); -require_once("types/galerie-photo.php"); - class CMS { - public static function affiche($chemin, $action = "afficher", $params=null) { - if (is_null($params)) $params = array(); + public static function affiche($chemin, $params) { + $action = $params["action"]; $p = Page::_new($chemin); @@ -28,27 +21,5 @@ class CMS { $p->affiche(); } } - - public static function en_tete($titre) { - return -'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> - <head> - <title>' . $titre . '</title> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <meta http-equiv="Content-Language" content="fr" /> - <link href="../style.css" rel="stylesheet" type="text/css" /><!-- TODO : chemin incorrect --> - </head> - <body> - <h1>' . $titre . '</h1>'; -// <meta name="keywords" lang="fr" content="motcle1,mocle2" /> -// <meta name="description" content="Description de ma page web." /> - } - - public static function pied() { - return -' </body> -</html>'; - } } ?> \ No newline at end of file diff --git a/__cms__/controleur/page.php b/__cms__/controleur/page.php @@ -2,6 +2,8 @@ require_once("util.php"); require_once("config.php"); +require_once("cms.php"); +require_once("squelette.php"); require_once("controleur/chemin_page.php"); // Protocole : http://site/actualités/?nouveau=Le%20titre @@ -148,9 +150,7 @@ class Page { } public function affiche() { - echo CMS::en_tete($this->chemin->get()) // TODO - . $this->vue() - . CMS::pied(); + echo Squelette::enrober($this, $this->vue()); } } diff --git a/__cms__/squelette.php b/__cms__/squelette.php @@ -0,0 +1,36 @@ +<?php + +require_once("util.php"); +require_once("path.php"); +require_once("controleur/page.php"); + +class Squelette { + public static function enrober($page, $contenu) { + return '' + . Squelette::en_tete($page) + . $contenu + . Squelette::pied($page); + } + + public static function en_tete($page) { + return +'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> + <head> + <title>' . $page->get_prop("titre") . '</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <meta http-equiv="Content-Language" content="fr" /> + <link href="../style.css" rel="stylesheet" type="text/css" /><!-- TODO : chemin incorrect --> + </head> + <body> + <h1>' . $page->get_prop("titre") . '</h1>'; +// <meta name="keywords" lang="fr" content="motcle1,mocle2" /> +// <meta name="description" content="Description de ma page web." /> + } + + public static function pied() { + return +' </body> +</html>'; + } +} +\ No newline at end of file