PHP generated website skeleton

This is where you share YOUR scripts with others

Moderators: macek, egami, gesf

somdcomputerguy
New php-forum User
New php-forum User
Posts: 14
Joined: Tue Oct 04, 2011 6:50 am
Location: West Virginia
Contact:

PHP generated website skeleton

Postby somdcomputerguy » Fri Sep 20, 2013 4:25 pm

This is a slimmed down bit of PHP code that I use to make the sites that I make.

Code: Select all

<?
include("menu.txt");
if (!isset($_GET['page'])) {
    include("mainpage.txt");
    exit;
}
if (file_exists($_GET['page'] . ".txt")) {
    echo "<script type='text/javascript'>document.title='Website - " . ucfirst($_GET['page']) . "';</script>";
    include($_GET['page'] . ".txt");
    exit;
  } else {
    include("404errorpage.txt");
    exit;
   }
}
?>

The nav links to other pages would be similar to this code

Code: Select all

<a href="?page=about">About</a>

The text files that get included to make up the different pages of the site can be in the main docroot directory, in a subdirectory, or be in another 'parent' directory. These text files can be made up of any combination of J/S, PHP, HTML, or just plain old text. CSS can be used to make all this look nice..

Return to “Your Scripts”

Who is online

Users browsing this forum: No registered users and 1 guest

cron