The Little Guy Posted November 28, 2006 Share Posted November 28, 2006 [code]<?phpfunction get_id($url){ $end = $url; $begin = $_SERVER['SCRIPT_NAME']; $var1 = str_replace($begin,'',$end); $var2 = str_replace('?id=','',$var1); return $var2;}echo 'http://'.get_id($_SERVER['REQUEST_URI']);?>[/code]http://tzfiles.com/phpcode/entities.php?id=d-top.org/display.php?artist=orgy Quote Link to comment Share on other sites More sharing options...
jpratt Posted November 28, 2006 Share Posted November 28, 2006 Why dont you use taiths function and add a substr to it to wack off the leading charaters you dont want? Quote Link to comment Share on other sites More sharing options...
closet geek Posted November 28, 2006 Author Share Posted November 28, 2006 [quote author=The Little Guy link=topic=116598.msg475304#msg475304 date=1164746628][code]<?phpfunction get_id($url){ $end = $url; $begin = $_SERVER['SCRIPT_NAME']; $var1 = str_replace($begin,'',$end); $var2 = str_replace('?id=','',$var1); return $var2;}echo 'http://'.get_id($_SERVER['REQUEST_URI']);?>[/code]http://tzfiles.com/phpcode/entities.php?id=d-top.org/display.php?artist=orgy[/quote]Thank you so much! I slightly adapted what you posted just then, for anyone who comes across this thread in the future this is the code I ended up using to get the behaviour I wanted:[code]<?phpfunction get_id($url){ $end = $url; $begin = $_SERVER['SCRIPT_NAME']; $var1 = str_replace($begin,'',$end); $var2 = str_replace('/transfer=','',$var1); return $var2;}$myvar = get_id($_SERVER['REQUEST_URI']);?> [/code]cg :) Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted November 28, 2006 Share Posted November 28, 2006 Your Welcome! It took time but we got it! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.