I have a navigational bar, an image, and a heading that I'll be including in every page of my website, so I wanted to use php include to refer to this code in several pages. However, I think I may have the syntax wrong or something because it's not rendering anything when I load it. Here are some code snippets:
<!-- sample page --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<?php include ('headings.php'); ?>
</head>
<body>
<?php include ('navbar.php'); ?>
<?php include ('image.php'); ?>
</body>
</html>
navbar.php
<?php
echo '<ul id="nav">
<li>
<a href="Home.html">Home</a>
</li>
<li>
<a>About Me</a>
<ul>
<li>
<a href="Career.html">Career</a>
</li>
<li>
<a href="Coding.html">Coding</a>
</li>
<li>
<a href="Personal.html">Personal</a>
</li>
</ul>
</li>
<li>
<a href="Travels.html">Travel</a>
</li>
<li>
<a href="Contact.html">Contact</a>
</li>
</ul>';
?>
Thanks for helping!
echo
. You can include it even if it's just raw HTML. Edit: That said, your code looks fine. Have you tried to view the source, and could you post it in the OP? Edit: Perhaps it's because PHP isn't installed on your server, and therefore your browser just renders the PHP tags as regular HTML tags (nothing).