Click to See Complete Forum and Search --> : [RESOLVED] Another way to $_GET?
I am familiar with the $_GET command, such that ?a=blah&c=balh2 and whatnot, but what I'm starting to see on the net is
http://www.you.com/search/results/what-i-searched-for-here
But a lot of times, the /results directory doesn't exist...
I was just wondering how to do this, it seems really clean, and I like it :)
Now I don't know what its called, so I really hope you can get what I'm trying to ask lol.
Thanks a lot.
h3r0
NogDog
03-30-2007, 10:51 PM
It's probably being done at the webserver level via URL rewriting with Apache mod_rewrite.
That's a good point...but I always thought it was done in PHP...
www.good-tutorials.com uses it in their search. And another thing I'm seeing is like:
www.example.com/dosomething?a=rawr
&
www.example.com/dosomethingelse?a=rawr2
They don't have index.php?a=rawr or something...just trying to learn. :)
pcthug
03-30-2007, 11:12 PM
Again, done at the webserver level via URL rewriting with Apache mod_rewrite.
Michaelttkk
03-31-2007, 06:16 AM
may be this might be the solution
www.example.com/dosomething?a=rawr
&
www.example.com/dosomethingelse?a=rawr2
index.php
<?php
if(isset($_GET['subject'])){
$subject = $_GET['subject'];
}else{
$subject = "article_index";
}
switch($subject){
case "article":
//case is index
include('article_index.php');
break;
default:
//doesnt match
include('article_index.php'); //include( $subject.'.php');
break;
case "page1":
//case is page1
include('page1.php');
break;
case "education":
//case is education
include('education.php');
break;
case "var":
//case is var
include('var.php');
break;
}
?>
article_index.php
<html>
<head>
</head>
<body>
My page <br>
<? blahblah
blah
?>
<a href=subject?education>Education</a><br>
<a href=subject?page1>Page 1</a><br>
<a href=subject?var>Var</a><br>
</body>
</html>
Znupi
03-31-2007, 08:19 AM
Is there any way in which you could specify an empty extension in the AddType Apache directive? That would be much easier than using mod_rewrite...