You can add HTML and your usual CSS tags to the PHP file which means your HTML file will only contain the content. This keeps it nice and clean and easy to edit. We’ll have a look at that later first let's say we want to include a menu file on our page using PHP. Your menu file could be a simple HTML file which includes the following –
<a href=http://www.yourdomain.com/index.php>Home</a><br />
<a href=http://www.yourdomain.com/about.php>About</a><br />
<a href=http://www.yourdomain.com/links.php>Links</a><br />
<a href=http://www.yourdomain.com/contact.php>Contact</a><br />
If you save your menu file as menu.html then you could reference it in your index.php file like this –
<?php include (“menu.html”); ?>
You can also include basic HTML for the content of the page so for example –
<?php include (“menu.html”); ?>
<p>This is the content for our index page.</p>
If you prefer you could also have the content for your page in a separate file in which case you would save the following as index.html
<p>This is the content for our index page.</p>
Then your PHP file would look like this –
<?php include (“menu.html”); ?>
<br />
<?php include (“index.html”); ?>