DarkPrince2005 Posted December 12, 2009 Share Posted December 12, 2009 Howzit phpFreaks I'm currently trying to build a module for Joomla... I'm building a query that uses the $_GET function to get the viewed articles id... it works fine except for the following problem on certain links. /index.php?option=com_content&view=article&id=2:lorem-ipsum&catid=3:site-content It gets the entire '2:lorem-ipsum' value when i only want the 2... Is there a way to just extract the numbers? Thanx in advance Quote Link to comment Share on other sites More sharing options...
oni-kun Posted December 12, 2009 Share Posted December 12, 2009 Roughly: $id = $_GET['ID']; $id = explode(':', $id); echo $id[0]; // echos 2, id[1] = lorem-ipsum Not sure it's 100% correct, I'm tired. explode Quote Link to comment Share on other sites More sharing options...
ngreenwood6 Posted December 12, 2009 Share Posted December 12, 2009 you can use the explode function(): $string = '2:lorem-ipsum'; $explode = explode(':',$string); echo $explode[0]; //prints 2 echo $explode[1]; //prints lorem-ipsum Quote Link to comment Share on other sites More sharing options...
oni-kun Posted December 12, 2009 Share Posted December 12, 2009 you can use the explode function(): $string = '2:lorem-ipsum'; $explode = explode(':',$string); echo $explode[0]; //prints 2 echo $explode[1]; //prints lorem-ipsum My post was verbatim and more relavent, Oh whatever. 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.