Have you ever been to a site and seen a index page or any page at all control everything such as
index.php?do=home&action=logout
something similar to the above? Well I am going to show you how easy it is to make this all own your own, and only have to use one web template or design to make it work.
Before we get started you need to go ahead and find the web design that you want to use.
After you find the site you want to use go ahead and save it... and save it like this so we can work together, ok!
Note* We are going to be skipping around a little bit and this probably will be a long tutorial but it is worth it.
1.) Create a New Folder Called site
2.) in the site folder save the page as temp.php
3.) do not move your css or img files into the same folder leave them in the root folder where your index file for your site is.
4.) now we are going to create the index page
CODE
<?php
$page = $_GET["do"]; // this is going to get the page that is being requested
$act = $_GET["action"]; // this is going to be the action that is going to be processed if any.
// We are now going to set where the "do" is going to go.
#######################################
# This is the home page #
#######################################
if( $page == "home" or $page == "main" or $page <= " " ){
include "site/temp.php";
}
#######################################
# This is the About Page #
#######################################
if( $page == "about" ){
include "site/temp.php";
}
#####################################
# Contact us Page #
#####################################
if( $page == "contact" ){
include "site/temp.php";
}
######################################
# Members Page #
######################################
// Note* you may want the user to login before hand, if you do so I would recommend using sessions, instead of cookies. for the purpose of this tutorial.
if( $page == "members" ){
include "site/temp.php";
}
// Note you can always make more members pages but to speed up things im just going to show you how to make them really fast
/*
if( $page == "members" and $act == "thepage" ){
include "site/temp.php";
}
*/
// Note* the $act == "thepage" is the page that you wish for them to request.. I have blocked commented it out....
####################################################
# Now this is when the user logs out only works with sessions. #
####################################################
if( $page == "members" and $act == "logout" ){
session_destroy();
header("Location: index.php");
}
?>
Now, you are probally thinking why doesn't he just make it all in one if? well, i tried it and got an error when i was designing my Exchange program.
especially when a user logged out, it would get an error. error would say HEADERS have already been sent.
So, whats next lets see now we need to make... a page that is going to show what needs to be shown... You need to add the content your self I am going to be using dummy text as an example.
So, lets create another file called show.php we need to save this in a new folder, so create a new folder called plugins
and then save it.
We need to add the following into the show.php file
Now this part may confuse you but I will explain it at the end.
You also need to create a couple more files,
for your index page create
a new folder inside of plugins and call it site and
so it would be like plugins > site
now create and save a file in this folder called home.php this will be your HOME PAGE!
so it should look like
plugins/site/home.php
now in the site folder still create a file called contact and about both with .php exts ok.
Ok, now we need to just go ahead and create the members page, remember i said you can just create all the pages you want, but i wasnt going to, it would take to long but i did show you how rember that... now for the members page go to the plugins folder and create a folder called members
and in that folder create a file called home.php
so it should look like plugins/members/home.php
In those files just go ahead and add your forms our what ever... adding dummy text would just make this tutorial way to long, so go ahead and add the content to all the files giving to create, or however you want to do it.
CODE
<?php
if( $page == "home" or $page == "main" or $page <= " " ){
include "plugins/site/home.php";
}
if( $page == "contact" ){
include "plugins/site/contact.php";
}
if( $page == "about" ){
include "plugins/site/about.php";
}
if( $page == "members" ){
include "plugins/members/home.php";
}
?>
That should do it for that file, now remember the temp.php file? make sure it is blank, and place the following code where you wish for the content to show up at
CODE
<?php include "plugins/show.php"; ?>
Now how does the navagation work? well, just remember what you created and how you wish to make it look in the url...
ex home page would be index.php?do=home
or about us index.php?do=about
or member logout index.php?do=members&act=logout
It's just so easy once you understand it. try it you will see and if you dont understand just PM me... also u can take a quick look at a example that is limited in functions, but shows u what it can do at
http://exchange.aogpro.com it is just to show you what it can do and most features are disabled, some dont even work at ALL!


