Click to See Complete Forum and Search --> : How is this done?


DanUK
11-28-2003, 06:54 AM
Hi there.
I've seen on various sites navigation like http://www.url.com/?mod=about

How is that achieved?

My old "page.php" which would load i.e. page.php?p=about worked -- but how is it achieved with just a ?mod=about

Thanks.

The page.php code:


<?php
if (isset($_GET['p'])) {
$p = (strstr($_GET['p'], ".php")) ? $_GET['p'] : $_GET['p'].".php";
if (file_exists($p)) {
include $p;
}
else {
include "index.php";
}
}
else {
include "index.php";
}
?>

PunkSktBrdr01
11-28-2003, 11:20 AM
It works the same way, but the code is in the index page.

"http://www.url.com/?mod=about" is the same as "http://www.url.com/index.php?mod=about".

DanUK
11-28-2003, 03:51 PM
I presume i'd need to change that code though???

Thanks.

Jona
11-29-2003, 12:04 PM
Originally posted by skydan
I presume i'd need to change that code though???

Only if you are going to change it from "p" to "mod."

[J]ona