commit 7c4fef596fb2684ab5182ccefb48539477df031a
parent 0e58eb753ace99e1b109053b79d15ba041ce5368
Author: Georges Dupéron <jahvascriptmaniac+github@free.fr>
Date: Sun, 4 Jul 2010 16:07:46 +0200
Affiche la bonne page et non pas "/galerie" à chaque fois.
Diffstat:
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/__cms__/cms.php b/__cms__/cms.php
@@ -11,8 +11,19 @@ require_once("types/galerie-evenement.php");
require_once("types/galerie-photo.php");
class CMS {
- public static function affiche($url) {
- $p = Page::_new("/galerie");
+ public static function uri_vers_chemin($uri) {
+ global $config_url_base;
+ // TODO : Pas propre !
+ $base = "/" . preg_replace("/^https?:\/\/[^\/]*\//", "", $config_url_base, 1);
+ if (strpos($uri, $base) == 0) {
+ return '/' . substr($uri, strlen($base));
+ } else {
+ return $uri;
+ }
+ }
+
+ public static function affiche($uri) {
+ $p = Page::_new(CMS::uri_vers_chemin($uri));
echo "<h1>Test</h1>";
echo $p->vue();
diff --git a/__cms__/config.php b/__cms__/config.php
@@ -3,7 +3,7 @@
require_once("util.php");
$config_url_base = "http://127.0.0.1/2010-moteur-site-simple/";
-$config_chemin_base = dirname(__FILE__);
+$config_chemin_base = dirname(__FILE__);
$config_chemin_modele = concaténer_chemin_fs($config_chemin_base, "/modele");
?>