note 30661 added to reserved.variables
| From: | NiN at ScreamingSlaves dot com | Date: | Tue, 25 Mar 2003 09:53:49 +0000 |
| Subject: | note 30661 added to reserved.variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-45784@lists.php.net to get a copy of this message | ||
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!
--
http://www.php.net/manual/en/reserved.variables.php
http://master.php.net/manage/user-notes.php?action=edit+30661
http://master.php.net/manage/user-notes.php?action=delete+30661
http://master.php.net/manage/user-notes.php?action=reject+30661