Includes

Without these owning a site would be a lot harder... Includes allow you to edit one file, and it changing all the files that have the include code in them. For example, if I wrote a new page, and I wanted to add it to the menu, I would only have to edit this one file and it would add it on every page (if the include code was on every page).

To use the includes, separate your page's code into three sections. The top, the content, and the bottom. That refers to the code, not the way the page looks on your web browser. Everything above your content section is the top section. Everything below your content section is the bottom section. All of your sites pages should have the same top and bottom section, and only the content section should vary from page to page. There are two options when using includes. PHP or SHTML. The two includes will do the same thing. I am using the PHP includes. I don't know why...

PHP Includes

If you are going to use the PHP includes, make sure to save all your pages as .php, instead of .html or whatever else. To use the PHP includes, you must take all of the HTML code that is in your top section (which is explained above), and copy it into a text file. Then do the same for your bottom section. It's best to save your top section's text file as "top.txt", and saving your bottom section's text file as "bottom.txt". Save these two files in the same directory as all of your pages, or you will have to add certain paths, that I won't go into. After you save these two files, delete all of your pages' code, except for the content area. So everything on a page that is saved into the top.txt or the bottom.txt goes. Finally, you are at the final step. The PHP code you must add to your page.

Because you now only have the content code in your page's code, you must somehow get the top.txt and bottom.txt on the page. That's what the code below does. Put the top.txt code at the beginning of the page's code, and the bottom.txt code at the... Yes. Bottom of the page's code. Here is the PHP code.

Top.txt code:

<?php include('top.txt'); ?>

Bottom.txt code:

<?php include('bottom.txt'); ?>

So, at the end, it should look something like this:

<?php include('top.txt'); ?>
CONTENT HERE
Blah Blah Blah
<?php include('bottom.txt'); ?>

SHTML Includes

No... I'm not going to write a whole bunch more for this. Why? Because it's almost the same. If you're going to use SHTML for includes, make sure to save your pages as .shtml, instead of .html or .php. The other only thing that changes it the code to use to include the things. They go in the same spot. Everything is the same between using the PHP and SHTML includes, except the endings of your pages, and the code to add to your pages to make the include happen. Here is the SHTML code.

Top.txt code:

<!--#include virtual="top.txt"-->

Bottom.txt code:

<!--#include virtual="bottom.txt"-->

So, at the end, it should look something like this:

<!--#include virtual="top.txt"-->
CONTENT HERE
Blah Blah Blah
<!--#include virtual="bottom.txt"-->

Disclaimer

All content, images, and layouts on Zak's Headquarters are copyrighted (c) to Zak, unless they are listed on the credits page. Pokémon is copyrighted (c) to Nintendo. I do not own Pokémon, and I did not create it. If you have any questions please contact me. This is a fansite.