PHP gevorderde |
|
probeer dit dan eens? je moet natuurlijk wel even de pagina's home.php, news.php en ietsanders.php maken en dit index.php noemen
<html>
<head>
<title>pagina, navigatie met $_GET</title>
</head>
<body>
<table border="1" width="50%">
<tr>
<td><a href="?page=home">Home</a> | <a href="?page=news">News</a> | <a href="?page=ietsanders">Iets anders</a></td>
</tr>
<tr>
<td>
<?php $page = (!isset($_GET['page'])) ? "home" : $_GET['page'];
switch(strtolower($page)) {
case 'home' :
$inc = 'home.php';
break;
case 'news' :
$inc = 'news.php';
break;
case 'ietsanders' :
$inc = 'ietsanders.php';
break;
default :
$inc = 'home.php';
break;
}
include($inc);
?>
</td>
</tr>
</body>
</html>
<html> <head> <title>pagina, navigatie met $_GET</title> </head> <body> <table border="1" width="50%"> <tr> <td><a href="?page=home">Home</a> | <a href="?page=news">News</a> | <a href="?page=ietsanders">Iets anders</a></td> </tr> <tr> <td> <?php $page = (!isset($_GET['page'])) ? "home" : $_GET['page']; case 'home' : $inc = 'home.php'; break; case 'news' : $inc = 'news.php'; break; case 'ietsanders' : $inc = 'ietsanders.php'; break; default : $inc = 'home.php'; break; } include($inc); ?> </td> </tr> </body> </html>
|