header
Posté : 12 juin 2011, 14:48
Bonjours je suis debutant en PHP / css et je souhaite tester un backgroud qui change en fonction de la page chargée
voici mon code:
header.php:
styles.css:
index.php:
logiquement mon index.php devrais inclure mon header avec par default l'image et le titre acceuil mais la rien ?????
pourtant je suis bien sous wamp les services sont op etc
help me please
voici mon code:
header.php:
Code : Tout sélectionner
<?
// extraction du nom de fichier courant, sans extension
$pageName = basename($_SERVER['PHP_SELF'],".php");
// attribution de l'image (et du titre, par la même occasion)
switch($pageName) {
case 'murs': $imagefond = "images/murs.jpg"; $title = "Murs"; break;
case 'sols': $imagefond = "images/sols.jpg"; $title = "Sols"; break;
case 'cuisinnes': $imagefond = "images/bains.jpg"; $title = "Cuisinnes"; break;
case 'realisations': $imagefond = "images/reas.jpg"; $title = "Realisations"; break;
default: $imagefond = "images/index.jpg"; $title = "Accueil"; break;
}
?>
<html><head>
<title><?= $title?></title>
<link type="text/css" rel="stylesheet" href="styles.css">
<style type="text/css">
body { background-image: url("<?= $imagefond?>") }
</style>
</head><body>Code : Tout sélectionner
body { background: #ccc 95% 95% fixed no-repeat }Code : Tout sélectionner
<? include('header.php'); ?>
<div>index</div>
</body></html>pourtant je suis bien sous wamp les services sont op etc
help me please