Jobsheet 9 PHP HTML
Jobsheet 9 PHP HTML
JOBSHEET #9
menu.php
<?php
$alamat_link = ["home.php", "Kategori.php", "artikel.php", "shop.php",
"login.php"];
$judul_link = ["Home", "Kategori", "Artikel", "Shop", "Login"];
?>
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Belajar PHP</title>
</head>
<style>
ul {
list-style: none;
padding: 0;
margin: 0;
width: 200px;
}
li a {
display: block;
background-color: #198C13;
color: white;
text-decoration: none;
font-size: 20px;
height: 30px;
line-height: 30px;
padding-left: 10px;
border-bottom: 2px solid #FFF;
}
li a:hover {
background-color: #0AED0A;
color: black;
}
</style>
<body>
<ul>
<?php
for ($i=0; $i<count($alamat_link); $i++)
{
?>
<li>
<a href="<?php echo $alamat_link[$i] ?>">
<?php echo strtoupper($judul_link[$i]) ?></a>
</li>
<?php
}
?>
</ul>
</body>
</html>
Materi Web Programmer | Pengenalan PHP
index.php
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Belajar PHP</title>
<style>
/* kode CSS disini */
</style>
<script>
// kode JavaScript disini
</script>
</head>
<body>
<!-- Header dari website-->
<header>
<h1>Menu Navigasi</h1>
<h2>Logo</h2>
</header>
<article>
<p>Konten Halaman Home</p>
</article>
<!-- Footer dari website-->
<footer>
<p>Copyright 2020 BLK Purworejo</p>
</footer>
</body>
</html>
Kode ini merupakan contoh struktur halaman HTML 'lengkap'. Lengkap maksudnya sudah
memiliki bagian header, logo, footer, serta tag <style> dan <script> untuk menempatkan kode
CSS dan JavaScript (walaupun hanya berupa kerangka saja).
Misalkan kode ini saya pakai untuk membuat halaman index.php. Tentunya halaman lain
seperti artikel.php, shop.php, dan contact_us.php juga menggunakan struktur yang sama.
Yang akan berubah hanyalah bagian 'konten' atau isi dari website. Bagian header
dan footer biasanya selalu tetap untuk tiap halaman.
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Belajar PHP</title>
<style>
/* kode CSS disini */
</style>
<script>
// kode JavaScript disini
</script>
</head>
<body>
<!-- Header dari website-->
<header>
<h1>Menu Navigasi</h1>
Materi Web Programmer | Pengenalan PHP
<h2>Logo</h2>
</header>