ibz786 Posted November 27, 2011 Share Posted November 27, 2011 Hi guys, i have not started this as of yet, however i will be given a project to make a micro-blogging website similar to that of Twitter or Facebook but obviously on a much smaller scale I have been searching on google however i have not found anything. Maybe i haven't been using the right words in my query, not sure :-/ I have been trying to do some research, however i can't seem to find how to incorporate @ tags found in Twitter / Facebook. e.g. If i want to tag a person in a Status Update: Hey @John Smith, Football in the park at 3pm? If anyone is able to help i would be grateful Thank You Quote Link to comment https://forums.phpfreaks.com/topic/251907-php-sql-tags/ Share on other sites More sharing options...
ignace Posted November 28, 2011 Share Posted November 28, 2011 You store the entered text in your database. And when you retrieve it, you resolve any @Username text to a link. Something like: // untested. if (preg_match('~@([^\s]+)~', $row['input'], $matches)) { if (username_exists($matches[1])) { $row['input'] = str_replace($matches[0], '<a href="' . username_link($matches[1]) . '">@' . $matches[1] . '</a>', $row['input']); } } Quote Link to comment https://forums.phpfreaks.com/topic/251907-php-sql-tags/#findComment-1291766 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.