note 30661 deleted from reserved.variables by sniper
| From: | sniper@php.net | Date: | Tue, 21 Oct 2003 19:43:38 +0000 |
| Subject: | note 30661 deleted from reserved.variables by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59070@lists.php.net to get a copy of this message | ||
Note Submitter: NiN@ScreamingSlaves.com
----
following: y at overminds dot org
One way I use in small websites (eg. only with changes in the layout) is to parse one var using
only:
http://localhost/index.php?onething
http://localhost/index.php?anotherthing
or even
http://localhost/index.php?i&want&even&anotherthing
if you find it somehow usefull :)
Here's the way that YOU TOO can do it, you hottie:
---------- <PHP> ----------
<?
$url = explode("?",$_SERVER['REQUEST_URI']); // get what comes after the ?
$vars = explode("&",$url[1]); // explode the *&*&*&* into the array
$vars[]
// now just use something like:
if($vars[0] == "news") {
$page = "news.php";
} else {
$page = "main.php"
}
if($vars[1] == "en") {
include("lang_en.php");
} else {
include("lang_pt.php");
}
?>
---------- </PHP> ----------
This is only good for simple pages, I recomend that you do not atempt this for any large website or
you'll confuse yourself; and pay special atention to making sure it's in the order you
expected it to be! (here the order counts! this is just getting worse, I know! :) This is just
suposed to create something more amusing than the usual:
index.php?id=news&lang=pt
to something like
index.php?news&pt
(can you see the beauty in it? :)
I trust many have came across this, not very helpful for the average coder but here's another
two cents :)
Happy coding!