...

View Full Version : grab URL text



sitNsmile
03-19-2010, 10:23 PM
Okay this one thing I am trying to do, example


http://www.site.com/Moto-Games.html

On the page, i need to it grab "Moto" as $title = 'Moto';
(leaving out the word "Games")

So I can do something like (just as example)
$sql_query = "SELECT * FROM games WHERE gametitle LIKE %$title%";

I know you can use " $_SERVER["REQUEST_URI"]; " to get the URL, Now just need to build a mod to read it and define the word.

Thanks

sitNsmile
03-19-2010, 10:48 PM
I'll try something like this. If you got a better idea, please share.


<?

$wordd = $_SERVER["REQUEST_URI"];
$wordd = str_replace("/", "", $wordd);
$wordd = str_replace("-Games.html", "", $wordd);

?>

MattF
03-19-2010, 10:52 PM
Untested:



if (strpos($_SERVER["REQUEST_URI"], '-Games.html') !== false)
{
$request = basename($_SERVER["REQUEST_URI"], '-Games.html');
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum