Created
July 11, 2011 06:51
-
-
Save ctrl-freak/1075396 to your computer and use it in GitHub Desktop.
Nice Filter Terms in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
if ($url_parts[1]!='') | |
{ | |
$args = array(); | |
for($i=0; $i<count($url_parts);$i++) { | |
switch($url_parts[$i]) { | |
case 'page': | |
{ | |
$args['page']=$url_parts[$i+1]; | |
break | |
} | |
case 'from': | |
{ | |
$args['from']=$url_parts[$i+1]; | |
break; | |
} | |
case 'over': | |
{ | |
$args['over']=$url_parts[$i+1]; | |
break | |
} | |
case 'under': | |
{ | |
$args['under']=$url_parts[$i+1]; | |
break; | |
} | |
case 'near': | |
{ | |
$args['near']=$url_parts[$i+1]; | |
break; | |
} | |
} | |
} | |
search($args); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could probably make this cleaner with an array of terms, and assign with $args[$term].