Need help to improve some code
Posted: Tue Nov 29, 2011 6:05 am
Hi, I've decided to make my own website from the ground-up to showcase the projects I work on in the future as I'm now starting to think I'd like to get into web development as a career. Can anybody suggest any improvements to this code, it's very basic as is, and I'll build upon it heavily in the coming weeks:
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<?php
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
$URLpieces=explode('.', basename(curPageURL()));
$PageTitle=str_replace('_',' ',$URLpieces[0]);
//NavPages Array
$navArray=array('Home', 'About Me', 'Portfolio', 'Contact');
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Lang" content="en">
<title><?php echo "Mike Ashfield - ".$PageTitle; ?></title>
<link rel="stylesheet" type="text/css" href="glabal.css">
</head>
<body>
<h1>Home</h1><br>
<ul>
<?php
foreach($navArray as $navItem) {
echo "<li><a href='htp://192.168.0.222/".str_replace(' ','_',$navItem).".php'>".$navItem."</a></li>";
}
?>
</ul>
</body>
</html>