include og switch
Så prøver vi igen<?
$page = $_GET['page'];
switch ($page)
{
case "home":
$home = "_active";
break;
case "collection":
$collection = "_active";
break;
case "available";
$available = "_active";
break;
case "projects":
$projects = "_active";
break;
case "links":
$links = "_active";
break;
case "contact":
$contact = "_active";
break;
default:
$home = "_active";
break;
}
?>
jeg benytter denne til at udskifte nogle billeder - javascript alt efter hva side man er på
samtidigt vil jeg gerne kunne include
en header
$_GET['page'].php
og footer
nu ser det sådan ud - men virker elendigt -->
<?php
include 'inc/header.php';
if (isset($_GET['page']) && $_GET['page'] != "") {
if (file_exists('inc/'.$pg.'.php')) {
@include ('inc/'.$pg.'.php');
} elseif (!file_exists('inc/'.$pg.'.php')) {
@include ('inc/nopage.php');
}
} else {
@include ('inc/home.php');
}
include 'inc/footer.php';
?>