pgsjoe Posted September 25, 2006 Share Posted September 25, 2006 this could be a waste of time and I apologize if it's already common knowledge. I was hoping there was a function that would make it as simple as:* scanning a field* if http://, www, or @ exist to turn the surrounding into a linkTried searching on google as well as the forums, but could not figure out the correct terms to search on. Does this function exist, if so, where...oh where do I find it?! Quote Link to comment Share on other sites More sharing options...
steveclondon Posted September 25, 2006 Share Posted September 25, 2006 don't know what you really want to do, explain a little more. surely if it is http: or an @ it will already be a link. Do you mean search other peoples sites your scripts???? Quote Link to comment Share on other sites More sharing options...
pgsjoe Posted September 25, 2006 Author Share Posted September 25, 2006 If someone enters in a paragraph of text with two or three links, as well as an e-mail address on my form and into the SQL database; in straight text format, no html on it whatsoever. Is there a function that I can use to scan the text and if anything is suppose to be a link, then to turn it into a link.Something like....[code]if (www) { $linktext = take remainder of text through ".com" (or whatever extension) to to the next space; echo '<a href="' . $linktext . '" target="_blank">' . $linktext . '</a> '; }if (@) { $emailtext = read text before @ symbol to a space, read text after @ symbol through next space. echo '<a href="mailto:' . $emailtext . '">' . $emailtext . '</a>'; }[/code]And the same for http:// 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.