matfish Posted August 19, 2006 Share Posted August 19, 2006 Hi, hard to explain and not sure if its simply possible..Say iv got a text feild in the database and im pulling it in so it looks like an article. If someone types in a URL like "This is an www.example.com" how can I make the URL clickable link in the article without them knowing the html tags etc..? I dont want them entering <a href= etc.. Thanks Quote Link to comment Share on other sites More sharing options...
onlyican Posted August 19, 2006 Share Posted August 19, 2006 yes it can be doneusing ereg_replace<?php$text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\">\\0</a>", $text);?> Quote Link to comment Share on other sites More sharing options...
matfish Posted August 20, 2006 Author Share Posted August 20, 2006 Sorry - dont understand?Tried it and it didnt make any difference...Thanks Quote Link to comment Share on other sites More sharing options...
onlyican Posted August 20, 2006 Share Posted August 20, 2006 using the ereg_replace, it will find www.example.com, and replace it with <a hreg='www.example.com'>www.example.com</a>not that it should be < / a > not [/url] 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.