elviapw Posted September 11, 2009 Share Posted September 11, 2009 I wrote a php form that allows members to log in and post to a blog. I'm wondering if there is a simple way to make sure that whenever a url is posted to the form, it will automatically be converted to a link so as to be clickable when it appears on the blog. I'm not sure which code to modify for this task -- the code that displays the information from the form, or on the form itself. I'm happy to post the code once I know which one makes more sense. Thanks for your help! Link to comment https://forums.phpfreaks.com/topic/173931-automatic-linking/ Share on other sites More sharing options...
p2grace Posted September 11, 2009 Share Posted September 11, 2009 I'd recommend converting the urls to links in the code that displays the results, not in the code that saves the post the database. Should be simple enough. Link to comment https://forums.phpfreaks.com/topic/173931-automatic-linking/#findComment-916892 Share on other sites More sharing options...
waynew Posted September 11, 2009 Share Posted September 11, 2009 As p2grace said, you should really only parse the links just before you output whatever they've posted. Use regular expressions to parse the links. preg_replace_all should do the job. Link to comment https://forums.phpfreaks.com/topic/173931-automatic-linking/#findComment-916895 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.