Welcome Guest ( Log In | Register )




Collapse

Top Submitters

· NickTheGreek (127)
·  (127)
· www.yourforum.gr (61)
· nickpar (20)
· Big (1)

Collapse

Random Tutorials

Screenshot από iPhone

Tutorial name: Screenshot από iPhone
Submitted by: NickTheGreek


Collapse

Announcments


Welcome to Tutorial System!

courtesy of www.ipsbeyond.com & www.invisionize.com



Print this Tutorial 

PHP Switch Function

Tutorial Information
Name: PHP Switch Function
Submitter: NickTheGreek
Category: IPS Tutorials
Submitted: 17 Sep 2007
Updated: 17 Sep 2007
Views: 517
Rating: This tutorial is unrated.
No image available
View All Tutorials By This Member
View Discussion Topic
Description:
Learn how to use the Switch function on your site.
Tutorial Instructions
This tutorial will allow you to have one file with multiple pages, just like IP.Board...
Lets get started:

Now you need your base file (index.php) this will hold the switch command, so open up your favourite editor and paste the following code:

CODE
<?php

//-----------------------------------
// Index.php Extension
//-----------------------------------

$act = $_GET['act'];
switch($act) {

//-----------------------------------
// Pages
//-----------------------------------

case "page1":
@include('page1.php');
break;

case "page2":
@include('page2.php');
break;

//-----------------------------------
// Home page
//-----------------------------------

default:
@include('home.php');
break;
}

?>


Now you can change the act text in here to whatever you want - "$act" - if you leave it the page will be "index.php?act=page1". Now you can change page1 & page2 to whatever you want the pages to be called e.g. "index.php?act=aboutus".
Now if you don't want your files to be called page1.php etc, you can change these e.g. "@include('aboutus.php');". Now the default lines are which page your site will load if you type in index.php with no extension, this would be known as the home page.

Now save this file as "index.php".

Now you need to program the included files, so you need to add information into all the files you stated e.g. home.php, page1.php & page2.php. So simply make new files and put in your page's information. You can use HTML only if you wish or if your more advanced you can put PHP into the page.

So now you need to upload all your files. Now you can type in index.php?act=page1 etc...

Remember you can add as many of these act= pages as you want!!!

Hope this tutorial helps, if you are still unsure on how to use this I will be uploading an attachment to the Tutorial's topic, containing all of the necessary files.

-Kindred
Comments
There have been no comments made as of yet. Why not be the first?



1 user(s) active
Active Users 1 guests, 0 members, 0 anonymous members
Sorted by Last Click
Quick Stats
Board Stats There have been a total of 244 tutorials in 6 categories and 0 sub-categories with 117106 views and 24 comments
The newest tutorial is How to Add “Move to” or “Copy to” to Windows 10’s Context Menu by NickTheGreek

RSS Lo-Fi Version Time is now: 21st June 2025 - 03:11 AM
Skin and Graphics by Dan Ellis and Anubis. Hosting by Forums & More © 2005-2011.
InvisionGames - Your #1 Arcade Games Repository | AllSigs - Signatures for all | Rock Band + Guitar Hero = RockHero ! | The Remoters - Remote Assistance | FileMiners - You ask, We find