I have some html files that are exactly the same, except for a little area where goes some text. And I was thinking if there was a way to save writing the same text in the 7 files.
I thought on a possible soluction, but I find it a bit messy:
I split the page in 2 parts, upper.php and lower.php:
upper.php
<html>
<head>
...
</head>
<body>
...
<div id=content>
lower.php
</div>
...
</body>
</html>
And then I write the different pages like this:
home.php
<? include "upper.php" ?>
Welcome to my webpage where I do random stuff.
<? include "lower.php" ?>
contact.php
<? include "upper.php" ?>
Contact me by sending an email to asdf@a.org
<? include "lower.php" ?>
etc..
I suspect that this is a very dirty way to do it, any other workaround?
That’s how I do all my websites. Sometimes there’ll be settings before the first
include(such as to determine if the user must be logged in or not), but for the most part that’s how I like to do things.The only real issue is to make sure that you don’t get mixed up if you have files in different folders. Other than that, you should be good.