Last Updated: February 25, 2016
·
1.087K
· xanza

PHP Site Navigation

Idiot proof site navigation based on the PHP case function:

<?php
//usage: nava.php?page={case}

switch($_GET['page']){
default: //the default page case    
include('index.php');
break;

case 'about':
include('pages/about.php'); //relative to the file
break;

case 'downloads':
include('/var/www/othersite.com/pages/download.php'); //absolute files are acceptable
break;
}
?>

Simply upload this PHP file to your web root, and once your cases are configured you have a pretty simple 'pretty url' script.

http://example.com/navagation.php?page=downloads

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.

Security insights from Cside