WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Website Engine
Categories : PHP, HTML and PHP, Templates Click here to Update Your Picture
Ron FREDERICK
Date : May 21st 2004
Grade : 3 of 5 (graded 6 times)
Viewed : 6352
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Ron FREDERICK
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

Ever wonder how others get their content to load in the same place and the menu, header and other regions of the site remain the same. Well, this example will show you how to create your own website engine.

Usage Example
URL: index.php?page=Contacts


SECTION ONE


This section shows the components of loading into the main content area (dynamic region) of your site.

1. The following specifies a default page or path+page.
Your primary (default) page will be called "_Home.php"

    <?php
   
if (!isset($page)) {
       
$page = "_Home";
    }
   
?>


2.        The following is what controls the path and what page to load.
        That is specified in the path set in the URL.
        
        
    <?php
    $LoadPage
= @include("$page.php");
   
?>


3.        The following will display a message if no page is found or if the path or page name are incorrect.
        
        
    <?php
   
if (!$LoadPage) {
        echo
"Sorry, the requested page is unavailable";
    }
   
?>



SECTION TWO


This section will show you how to load your "static regions" such as your menus, header, navbar and footers.

<?php
$header
= @include("_Header.php");
if (!
$header) {
    echo
"Header region could not get displayed";
}
$menu = @include("_Menu.php");
if (!
$menu) {
    echo
"Menu region could not get displayed";
}
$footer = @include("_Footer.php");
if (!
$footer) {
    echo
"Footer region could not get displayed";
}
?>


SECTION THREE

This section will show you how to put it all together using a table and the examples above.

Additional pages you will need to make yourself are:
_Home.php, _Header.php, _Menu.php, _Footer.php

NOTE: DO NOT include html, head or title tags in your added pages.

Begin engine

<?php
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
echo
"<html>\n";
echo
"<meta http-equiv=\"content-type\" content=\"text/html;charset=iso-8859-1\">\n";
echo
"<title>Site title goes here</title>\n";
echo
"<style type=\"text/css\" media=\"screen\">
        <!--
        body { color: #000000; font-size: 12px; font-family: Aria }
        td { color: #000000; font-size: 12px; font-family: Arial }
        a { color: #000000; font-size: 12px; font-family: Aria; text-decoration: underline }
        a:hover { color: #8B0000 }
        .Header_Region { background-color: #F0E4DD }
        .Menu_Region { background-color: #CDDBD8 }
        .Primary_Region { background-color: #F5F5F5 }
        .Footer_Region { background-color: #CEDBCD }
        -->
    </style>\n"
;
echo
"<body>\n";
echo
"<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
echo
"<tr>\n";
echo
"<td class=\"Header_Region\">\n";
   
// Displays header - _Header.php
$header = @include("_Header.php");
if (!
$header) {
    echo
"Header region could not get displayed";
}

echo
"</td>\n";
echo
"</tr>\n";
echo
"<tr>\n";
echo
"<td>\n";
echo
"<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" height=\"350\">\n";
echo
"<tr>\n";
echo
"<td width=\"160\" valign=\"top\" class=\"Menu_Region\">\n";

// Displays menu - _Menu.php
$menu = @include("_Menu.php");
if (!
$menu) {
    echo
"Menu region could not get displayed";
}

echo
"</td>\n";
echo
"<td valign=\"top\" class=\"Primary_Region\">\n";
   
// Displays primary content - Default page - _Home.php
if (!isset($page)) {
   
$page = "_Home";
}
$LoadPage = @include("$page.php");
if (!
$LoadPage) {
    echo
"Sorry, the requested page is unavailable";
}

echo
"</td>\n";
echo
"</tr>\n";
echo
"</table>\n";
echo
"</td>\n";
echo
"</tr>\n";
echo
"<tr>\n";
echo
"<td class=\"Footer_Region\">\n";

// Displays footer - _Footer.php
$footer = @include("_Footer.php");
if (!
$footer) {
    echo
"Footer region could not get displayed";
}

echo
"</td>\n";
echo
"</tr>\n";
echo
"</table>\n";
echo
"</body>\n";
echo
"</html>\n";
?>



PHP3: Formmail. Just a cgi formmail, but than in PHP. It is easy to use!
Categories : HTML and PHP, Email, PHP, Perl, HTML and PHP
PHP template processing
Categories : PHP, Templates, HTML and PHP
Complete, simple working example of login screen and check on a unique page using php functions, cookies and mysql database.
Categories : PHP, Cookies, MySQL, HTML and PHP, Authentication
PHPixel - output of 1 pixel transparent/colored gif for counters etc.
Categories : PHP, Graphics, HTML and PHP
Yahoo! Messenger Friend List
Categories : PHP, CURL, HTML and PHP
PHP MultiList Mailing List Manager
Categories : Email, HTML and PHP, PHP
How to use regular expressions to get the list of links from an HTML page
Categories : PHP, Regexps, HTML, HTML and PHP
Produces browser-safe strings while preserving HTML tags.
Categories : Strings, HTTP, PHP, HTML and PHP
Simple PHP/3 Access Counter (using GD and DBM functions)
Categories : Databases, PHP, Graphics, HTML and PHP, dBase
Pull Down Surfing - Surf on Change
Categories : Java Script, MySQL, HTML and PHP, PHP, Databases
Dynamic CSS generation for multiple website colouring schemes.
Categories : PHP, CSS, HTML and PHP
Using PHP im HTML image tags
Categories : PHP, HTML and PHP, Graphics, Beginner Guides
A simple php file uploader
Categories : PHP, Filesystem, HTML and PHP
This script allows people to add their favorite quotes to your website. This could easily be modified to be a guestbook script or comment page script.
Categories : PHP, Complete Programs, HTML and PHP, Misc
Upload images restricted by pixel size (Picture width and Picture Height)
Categories : PHP, HTML and PHP, Graphics