Welcome and have a nice stay !       login   register   need help?  

 Page Info

Page Title: URL navigator
Description: Use of the switch function to choose the page to display given in the URL
Author: Dumb Genius
Submission Date: 21-01-2005 10:41

 Rating & Comments

View or add comments: (0)
Average members rating: 0



This tutorial will help you to get different pages by using links like "index.php?page=news".

Code of index.php:

Code :
// hide source code
// hide line numbers

 1  <?PHP
 2    
switch($_GET['page']){
 3      case 
'news':
 4      include(
"news.php");
 5      break;
 6      case 
'files':
 7      include(
"files.php");
 8      break;
 9      default:
10      echo 
"Error, the requested page does not exist.";
11      break;
12    }
13  
?>



The first part of the URL indicates what you want, in this case, we want page. Then the rest will determine what page will be displayed in function of the chosen case: news, files... You can add as many case as you want as long as you have created the pages (php files).
If the case you specified doesn't exist, then it will 'echo' (display) the message:

Quote
Error, the requested page does not exist.

Donation:

If you like our free quality work, make a donation by using Paypal and tell us what you would like to see improved on our site for the next few months.

Comments


No comments yet

 Site Activity
Currently online: 0 member(s), 39 guest(s) : All members offline.


 Quick Menu
sitemap
search
galleries
main
forums


 Our Services

Main Projects
Designers For Hire
Unique LDU Skins
LDU Skins For Sale
Seditio Skins For Sale
Templates For Sale


 Statistics
18582 registered members,
1870 topics in forums,
21586 posts in forums,
13589725 pages served since 2004-05-09.
more


 7th Version Design

+++
top