I have tried substituting my html code for include PHP references. It works on the index.php but the three includes, header menu and footer do not appear on the other pages, though the content and spaces are there.
I used the original working index.html to make a copy called index.php and saved this. I chop out the header, menu and footer html code substituting an include instruction each time. I saved these snippets html code as 3 html files. The remaining file contents were saved as a template. Everything is good on the trial on the web hosting site. Header Menu and Footer all display correctly. I used the template then to make other pages, inputting only the text and graphics which all display correctly from the index.php start and I use the browser back button to check other pages. I have checked the original index.php alongside the template to make sure I only removed the content of the 3 files. All the files are in one folder on the host. I am missing something basic, could it be the three files to be included are not given absolute paths?
website is www.crowegenealogy.net for reference?
template code below
<!DOCTYPE html>
<html lang="en">
<head>
<title>Crowe Genealogy - Ireland and the World</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link href="css/layout.css" rel="stylesheet" type="text/css">
<link href="css/menu.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php include 'header.html' ;?> <br>
<div class="container"><br>
<ul id="nav">
<?php include 'menu.html' ;?>
</ul>
</div>
<p><br>
<?php include 'footer.html' ;?> </p>
</body>
</html>
source https://stackoverflow.com/questions/71256499/php-include-for-header-menu-footer-works-on-index-php-but-not-other-pages
No comments:
Post a Comment