Effervescent

This is just my temporary blog till I create my own on my site, one that actually counts statistics (posts, profile views, etc) correctly.

Name:
Location: Colombo, Sri Lanka

There's way too much to type.

2005-07-11

Navigation menu in PHP

this is the basic concept of how i handle navigation in PHP.
it's not commented but it's very basic but if there is something you want to ask, just ask on this blog :)




<?php
$prefix = '/path/to/file/myPrefix.';
$postfix = '.inc.php';
$defaultPage = 'home';
$errorPage = '404';

$incFile = $prefix . $_GET['page'] . $postfix;
$default = $prefix . $defaultPage . $postfix;
$error = $prefix . $errorPage . $postfix;
if(file_exists($incFile))
{
switch($_GET['page'])
{
case 'home':
case 'about':
case 'contact':
include_once $incFile;
break;

case '':
@include_once $default;
break;

default:
@include_once $error;
break;
}
}
else
{
echo '<h1>Page Not Found: 404</h1>';
}
?>


10 Comments:

Blogger Tony said...

I wish i had a comment relevant to the post, but i dont get it, so i wont.

I just worked 23 hours :'(

July 11, 2005 at 9:29 AM  
Blogger ross820sidney said...

damn good blog, check out mine http://juicyfruiter.blogspot.com, comments always welcome!

August 21, 2005 at 11:33 PM  
Blogger Infactahost.com said...

Hey, you have a great blog here! I'm definitely going to bookmark you!

I have a php script free photo gallery site/blog. It pretty much covers php script free photo gallery related stuff.

Come and check it out if you get time :-)

October 26, 2005 at 12:13 PM  
Blogger hassan said...

Hi PHPCoder :)

Great post on Navigation menu in PHP. You have a great blog here; keep up the great work!

I have a site on Airlines Schedule, check it out if you get some time and I will be sure to visit here regularly!

November 6, 2005 at 5:08 PM  
Blogger hassan said...

Hi PHPCoder :)

Great post on Navigation menu in PHP. You have a great blog here; keep up the great work!

I have a site on USA Driving Distance Calculator, check it out if you get some time and I will be sure to visit here regularly! You can also check out my other site on Resell Rights eBooks if you get time.

November 8, 2005 at 5:38 AM  
Blogger hassan said...

Hi PHPCoder :)

Great post on Navigation menu in PHP. You have a great blog here; keep up the great work!

I have a site on Country To Airport Names, check it out if you get some time and I will be sure to visit here regularly! You can also check out my other site on Resell Rights eBooks if you get time.

November 8, 2005 at 6:11 AM  
Blogger TadaDiscounts said...

Great site!

Please check out my blog- Shavers

Or your my be interested in my other site- Shavers where you can find Shavers

November 10, 2005 at 2:23 PM  
Blogger eddhunor11205173 said...

I read over your blog, and i found it inquisitive, you may find My Blog interesting. My blog is just about my day to day life, as a park ranger. So please Click Here To Read My Blog

January 2, 2006 at 6:39 PM  
Blogger johneytheobold4752 said...

I read over your blog, and i found it inquisitive, you may find My Blog interesting. So please Click Here To Read My Blog

http://pennystockinvestment.blogspot.com

January 25, 2006 at 12:56 AM  
Blogger tandyclinton68217735 said...

Get any Desired College Degree, In less then 2 weeks.

Call this number now 24 hours a day 7 days a week (413) 208-3069

Get these Degrees NOW!!!

"BA", "BSc", "MA", "MSc", "MBA", "PHD",

Get everything within 2 weeks.
100% verifiable, this is a real deal

Act now you owe it to your future.

(413) 208-3069 call now 24 hours a day, 7 days a week.

May 8, 2006 at 1:58 PM  

Post a Comment

<< Home