Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Making A One Page Does All Website In Phph
cwconline
post Jun 30 2007, 07:50 PM
Post #1


Member [Level 1]
****

Group: Members
Posts: 60
Joined: 25-February 07
From: Somewhere Your Not! Well... Maybe your here. Who Knows?
Member No.: 39,197



Hello and Great Day or Night either one.

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!
Go to the top of the page
 
+Quote Post
saulg
post Jul 5 2007, 03:30 AM
Post #2


Newbie [Level 1]
*

Group: Members
Posts: 10
Joined: 4-July 07
Member No.: 45,947



i'M Gonna have to try to do this... i'm not shure if we should do this, maybe could yuou tell me why this method is better than others. I really dont think this is better, cuz if you use POST then your users cant save links, or exchange them...
Go to the top of the page
 
+Quote Post
flopadmi
post Aug 7 2007, 08:27 AM
Post #3


Newbie
*

Group: Members
Posts: 8
Joined: 5-August 07
Member No.: 47,623



QUOTE(saulg @ Jul 5 2007, 08:30 AM) *
i'M Gonna have to try to do this... i'm not shure if we should do this, maybe could yuou tell me why this method is better than others. I really dont think this is better, cuz if you use POST then your users cant save links, or exchange them...

yah man nice to see u
thanks
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. E-mail Mailer Script 0.1(4)
  2. Secure The Email Addresses On Your Website!(10)
  3. Making A Webserver Directory Listing(6)
  4. Centered Website With Fixed Width(2)
  5. Centered Website With Two Columns(12)
  6. Making Shadows Without Images(4)
  7. Tutorial: Installing D-shoutbox For Ipb V1.2(12)
  8. Making Winrar Archives(12)
  9. Making And Editing A New Ipb V1.2 Skin(0)
  10. Introduction To Templating(1)
  11. Configuring Dns Settings For Website(1)
  12. Checking Dns Settings For Website(2)
  13. How To: Make A Simple Php Site(21)
  14. Making Interactive Cds With Flash(2)
  15. Making A Dynamic Page On Blogspot(5)
  1. Making The Popular Id Browsing For Your Site.(17)
  2. Making a java based program(3)
  3. Adding Your Website To Google(25)
  4. Creating A Resume(1)
  5. Css Scroll Bar Styles(1)
  6. Creating Navigation For Html Websites(12)
  7. Making A Song In Fruity Loops Part 2(0)
  8. Making A Song In Fruity Loops Part Three(1)
  9. How To Setup A Website After Your Forum(3)
  10. Ftp In Visual Basic 6.0(1)
  11. How To Make An Ultimate Game List.(0)
  12. Making Calculators with PHP(4)


 



- Lo-Fi Version Time is now: 8th September 2008 - 07:55 AM