If you want the same content copied over multiple pages of your site, with HTML you'll need to manually copy and paste that content. But if you have PHP on your server you can write one file and then include it on your Web pages where you need it.
PHP requires that you have it installed on your Web server. Contact your system administrator if you're not sure.
- Write the HTML you want repeated and save it to a separate file.
I like to save my include files into a separate directory, usually "includes". I would save my copyright information in an include file like this:
- Open the Web page where you want the include file to display.
- Find the location in the HTML where the include file should display, and place the following code there:
require($DOCUMENT_ROOT . "includes/copyright.php");
- Change the path and file name to reflect your include file location.
- Add that same code to every page you want your copyright information on.
- When the copyright information changes, edit the
copyright.phpfile. Once you've uploaded it to the
includes/directory, it will change on every page of your site.
- You can include HTML or text in a PHP include file. Anything that can go in an standard HTML file can go in a PHP include.
- Your entire page should be saved as a PHP file, eg. index.php rather than HTML. Some servers don't require this, so test first.
What You Need
- PHP on the server