How to make hashtag on my website?
|
02-18-2014, 07:16 PM
Post: #5
|
|||
|
|||
I would say learn some more PHP, and MySQL since you'll want databases to store your messages. Then with some basic regular expressions you can extract #hashtagged words and convert them to links to search for the #hashtag when displaying a message and some basic MySQL queries to search for messages that contain said #hashtag.
Maybe <?php function hashToAnchor( $message ) { return preg_replace( '/#(\w.)/g' , '<a href = "/search?q=${1}' , $message ); } ?> To add links to messages and maybe <?php $q = $_GET['q']; mysql_query( "SELECT * FROM table WHERE message LIKE \"%#$q%\""); ?> to retrieve messages containing a certain hash tag Sample code is incomplete and probably inaccurate, just something to (hopefully) point you in the right direction on your journey into databases and searching. Good luck! |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
How to make hashtag on my website? - Liam - 02-18-2014, 06:30 PM
[] - Mister.Chrispy - 02-18-2014 07:16 PM
|
User(s) browsing this thread: 1 Guest(s)