commit 84acf3552412185f18afb7f008f150b1bd68e9e0
parent 57218d787a4b16cb805991b701aad4ffcb1b553e
Author: Georges Dupéron <jahvascriptmaniac+github@free.fr>
Date: Thu, 8 Jul 2010 05:04:35 +0200
Le titre de la page est le dernier segment du chemin.
(Facile à faire depuis que CheminPage utilise un tableau de segments).
Diffstat:
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/__cms__/controleur/chemin_page.php b/__cms__/controleur/chemin_page.php
@@ -19,12 +19,11 @@ class CheminPage {
}
public function parent() {
- $slash = strrpos($this->chemin, '/');
- if ($slash !== false) {
- return substr($this->chemin, 0, $slash);
- } else {
- return '/';
- }
+ return '/'.array_slice($this->chemin, 0, count($this->chemin) - 1);
+ }
+
+ public function dernier() {
+ return $this->chemin[count($this->chemin) - 1];
}
public static function nettoyer_chemin($chemin) {
diff --git a/__cms__/squelette.php b/__cms__/squelette.php
@@ -17,13 +17,13 @@ class Squelette {
'<!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>
+ <title>' . $page->chemin->dernier() . '</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>';
+ <h1>' . $page->chemin->dernier() . '</h1>';
// <meta name="keywords" lang="fr" content="motcle1,mocle2" />
// <meta name="description" content="Description de ma page web." />
}