i am designing a site with a comment system and i would like a twitter like reply system.
The if the user puts @a_registered_username i would like it to become a link to the user’s profile.
i think preg_replace is the function needed for this.
$ALL_USERS_ROW *[‘USERNAME’] is the database query array for all the users and [‘USERNAME’] is the username row.
$content is the comment containing the @username
i think this should not be very hard to solve for someone who is good at php.
Does anybody have any idea how to do it?
You want it to go through the text and get it, here is a good starting point:
Generated with:
[edit]
Actually, if you go here ( http://www.gskinner.com/RegExr/ ), and search for twitter in the community tab on the right, you will find a couple of really good solutions for this exact problem: