Last active
August 29, 2015 14:21
-
-
Save bangiqi/b7ab9a43d9c368de20c5 to your computer and use it in GitHub Desktop.
membuat website pribadi terdiri dari 4 menu [ home , my future, my job, contact ] , untuk halaman [aboutus.php, home.php, profile.php] dimasukan kedalam folder pages, dan script masing-masing file adalah sebagai berikut :
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo "about us"; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo "halaman home"; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="index.php">Home</a> | |
<a href="index.php?p=profile">Profile</a> | |
<a href="index.php?p=aboutus">About Us</a> | |
<br/> | |
<br/> | |
<?php | |
$pages_dir = 'pages'; | |
if(!empty($_GET['p'])){ | |
$hal = scandir($pages_dir, 0); | |
unset($hal[0], $hal[1]); | |
//var_dump($hal); | |
$p = $_GET['p']; | |
if(in_array($p.'.php', $hal)){ | |
include($pages_dir.'/'.$p.'.php'); | |
}else{ | |
echo 'Halaman tidak ditemukan! :( '; | |
} | |
}else{ | |
include('pages/home.php'); | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo "halaman profile"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment