Royale-Graphics
Member
I am trying to create navigation using PHP to update my website automatically when an extra button is added. I have followed an online tutorial, but it doesn't seem to be working.
I have created a PHP file for the navigation and then my usual html file. I have used 'include', but I'm not sure if I have coded it incorrectly. The code is below :icon_smile:
(index.html)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/styles.css"/>
<?php include('scripts/nav.php'); ?>
</head>
<body>
<div id="tabs4">
<?php showNavigation('scripts/nav.php'); ?>
</div>
</body>
</html>
(nav.php)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
function showNavigation() {
echo '<div id="tabs4">
<ul>
<li><a href="../index.html"><span>Home</span></a></li>
<li><a href=""><span>Price List</span></a></li>
<li><a href=""><span>Examples</span></a></li>
<li><a href=""><span>Styles</span></a></li>
<li><a href=""><span>Stock Images</span></a></li>
<li><a href=""><span>Artwork</span></a></li>
<li><a href=""><span>How to Order</span></a></li>
<li><a href=""><span>Contact Us</span></a></li>
<li><a href=""><span>About Us</span></a></li>
<li><a href=""><span>Links</span></a></li>
</ul>
</div> ';
}
?>
</body>
</html>
I have created a PHP file for the navigation and then my usual html file. I have used 'include', but I'm not sure if I have coded it incorrectly. The code is below :icon_smile:
(index.html)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/styles.css"/>
<?php include('scripts/nav.php'); ?>
</head>
<body>
<div id="tabs4">
<?php showNavigation('scripts/nav.php'); ?>
</div>
</body>
</html>
(nav.php)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
function showNavigation() {
echo '<div id="tabs4">
<ul>
<li><a href="../index.html"><span>Home</span></a></li>
<li><a href=""><span>Price List</span></a></li>
<li><a href=""><span>Examples</span></a></li>
<li><a href=""><span>Styles</span></a></li>
<li><a href=""><span>Stock Images</span></a></li>
<li><a href=""><span>Artwork</span></a></li>
<li><a href=""><span>How to Order</span></a></li>
<li><a href=""><span>Contact Us</span></a></li>
<li><a href=""><span>About Us</span></a></li>
<li><a href=""><span>Links</span></a></li>
</ul>
</div> ';
}
?>
</body>
</html>