ang. switch funktion
Hejsa.Jeg har denne test side:
http://www.dummierun.dk/test/phpswitch/
Når jeg trykker på hvert link vises der en side nedenunder.. Det fungerer optimalt.
Jeg ville så derfor gerne have, at det blå link skiftede plads alt efter hvilket link der er trykket på, har bare ikke kunnet få det til at fungerer.
index::::
<!DOCTYPE html>
<html lang="da-DK">
<head>
<title>PHP | Switching |</title>
<style type="text/css">
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 12px;
}
.nav {
position: relative;
top: 100px;
left: 200px;
}
.menu li {
list-style-type: none;
float: left;
margin-right: 10px;
}
.menu li a {
text-decoration: none;
}
.switch {
position: relative;
top: 200px;
left: 20px;
}
.activeLink {
color: #7fd6ef;}
</style>
</head>
<body>
<div class="nav">
<?php include 'include/header.php'; ?>
</div>
<div class="switch">
<?php include 'switch.php'; ?>
</div>
</body>
</html>
switch:::
<?php
$forside ="activeLink";
$portfolio ="myButtons";
$profil ="myButtons";
$links = "myButtons";
$feedback = "myButtons";
$array = ('forside, portfolio, profil, links, feedback');
if($array == "forside"){
$index = 'activeLink';
} else if ($array == "portfolio"){
$portfolio = 'activeLink';
} else if ($array == "profil"){
$profil = 'activeLink';
} else if ($array == "links"){
$links = 'activeLink';
} else if ($array == "feedback"){
$feedback = 'activeLink';
}
?>
<ul class="menu">
<li><a class="<?php echo $forside; ?>" href="?page=forside">Forside</a></li>
<li><a class="<?php echo $portfolio; ?>" href="?page=portfolio">Portfolio</a></li>
<li><a class="<?php echo $profil; ?>" href="?page=profil">Profil</a></li>
<li><a class="<?php echo $links; ?>" href="?page=links">Links</a></li>
<li><a class="<?php echo $feedback; ?>" href="?page=feedback">Feedback</a></li>
</ul>
header:::
<?php
if (!empty($_GET)) {
$allowedIncludes = array(
'forside' => 1,
'portfolio' => 1,
'profil' => 1,
'links' => 1,
'feedback' => 1
);
if ($allowedIncludes[$_GET['page']]) {
include('include/'.$_GET['page'].'.php');
}
} else {
include('include/forside.php');
}
?>