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 Link to comment https://forums.phpfreaks.com/topic/18036-creaking-a-ahref-link/ 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);?> Link to comment https://forums.phpfreaks.com/topic/18036-creaking-a-ahref-link/#findComment-77275 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 Link to comment https://forums.phpfreaks.com/topic/18036-creaking-a-ahref-link/#findComment-77588 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] Link to comment https://forums.phpfreaks.com/topic/18036-creaking-a-ahref-link/#findComment-77675 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.