maxudaskin Posted May 6, 2008 Share Posted May 6, 2008 How could I turn some text formatted like this: http://www.someurl.com into <.a href="http://www.someurl.com">http://www.someurl.com</.a> Please ignore the periods, they are there to prevent the a href part from turning invisible. Quote Link to comment https://forums.phpfreaks.com/topic/104307-turn-into/ Share on other sites More sharing options...
DarkWater Posted May 6, 2008 Share Posted May 6, 2008 Uhh.... $sometext = "http://www.someurl.com"; echo '<a href="' . $sometext . '">' . $sometext . '</a>'; Quote Link to comment https://forums.phpfreaks.com/topic/104307-turn-into/#findComment-534074 Share on other sites More sharing options...
maxudaskin Posted May 6, 2008 Author Share Posted May 6, 2008 I forgot about the catch... It is in a database as a post... Hey everyone, I found this cool site at http://www.coolsite.net and I thought you'd like to take a look! Some User Quote Link to comment https://forums.phpfreaks.com/topic/104307-turn-into/#findComment-534077 Share on other sites More sharing options...
atravotum Posted May 6, 2008 Share Posted May 6, 2008 If its in a database as a post then to the best of my knowledge its been stripped of its previous html format. You would have to write a function that runs through the post, looks for a particular string say http://www.blah.com, omits it and replaces it with your html tag upon printing to the screen. There are a variety of string functions in php that could do this pretty painlessly. Quote Link to comment https://forums.phpfreaks.com/topic/104307-turn-into/#findComment-534093 Share on other sites More sharing options...
AndyB Posted May 6, 2008 Share Posted May 6, 2008 Here's the perfect solution. I know it works. http://www.phpfreaks.com/forums/index.php/topic,106159.msg424327.html#msg424327 Quote Link to comment https://forums.phpfreaks.com/topic/104307-turn-into/#findComment-534105 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.