Home Square Enix Forums Topsites Links Affiliation Staff About History of HHN Hell and Heaven Net
Feature: History of Final Fantasy

Final Fantasy series

  • Final Fantasy VII
  • Advent Children
  • Dirge of Cerberus
  • Crisis Core
  • Final Fantasy VIII
  • Final Fantasy IX
  • Final Fantasy X
  • Final Fantasy X-2
  • Final Fantasy XI
  • Final Fantasy XII
  • Final Fantasy XIII
  • Final Fantasy Versus XIII
  • Final Fantasy XIV

Other games

  • Kingdom Hearts
  • Kingdom Hearts II
  • Grandia
  • Grandia II
  • Grandia III
  • Star Ocean III
  • Star Ocean: The Last Hope
  • The Last Remnant
  • Legend of Dragoon

The Website

  • Home
  • News Archive
  • Reviews
  • Affiliation
  • Blacklist
  • History of HHN
  • About Us / FAQ
  • Staff
  • Credits
  • Contact Us
  • Link to Us
  • Links

Interaction

  • Forums
  • Topsites
  • HHN Radio
  • Al Bhed Translator
  • Tic Tac Toe
  • Release Dates

Multimedia

  • Flash Movies
  • Movies & Trailers
  • Music
  • Roms & Emulators
  • Screensavers
  • Winamp Skins

Webmaster Stuff

  • Tutorials
  • PHP Scripts
  • Free Layouts
  • Free Buttons
  • Free Banners
  • Free Hosted Scripts
  • Free Hosts

Affiliates

  • Final Fantasy Mages
  • Final Fantasy Nemesis
  • Final Fantasy Source
  • Final Fantasy Union
  • Final Fantasy XIII
  • Sound-Test
  • Square Anthology

Network

  • Dragon Ball Kai .NL
  • South Park Fan

» Tutorials » PHP Include

This tutorial explains how to include pages with PHP that makes it easier to change pages and layout without having to edit all pages.

First you need to be sure that your host supports PHP, otherwise this tutorial is no use for you. Only a few free hosts support PHP. Contact your host for more information.

1) Make a layout in HTML and when you're done save it as a .php file (for this tutorial let's call it index.php.

2) Make a page with the content you want to include and save it. You can save it as a .txt file, but if you use php codes in the .txt file other people can see it. So it's better to save it as a .php file.

3) In the layout file place this code on the place you want the content to appear.

<?
$p = $_GET['p'];

if ($p) {
 if (file_exists("$p.php")) {
 include("$p.php");
} else {
 echo "404 Error - Page Not Found";
}
} else {
 include("page.php");
}
?>

You can change the 'p' into whatever you like, but be sure to change all 'p', otherwise the code won't work. Change page.php into your opening page file, like news/news.php for Fusion News.

4) Go to your browser and type: www.yourdomain.com/index.php?p=staff. staff stands for the name the content file has (staff.php) and 'p' is the variable. When you called your layout file index.php you can remove the index.php from the url, so it will looks like this: www.yourdomain.com/?p=staff.

¤ The Easy Way

There also a much easier way to include just one php file. The code is:

<? include("page.php"); ?>

Just change page.php to the location where the file is stored that you want to include.

This ends the PHP include tutorial, if you have questions or need help with the code, you can send me a mail using the contact form.

Final Fantasy Topsites Final Fantasy Mages Topsites Final Fantasy Otaku Topsites