.Darkman Posted March 15, 2007 Share Posted March 15, 2007 Hello, Now, many sites out there uses folksonomy (i.e) tags. For eg, del.icio.us uses tags related to the link. I'd like to know how it works. I am planning to write a script like del.icio.us (just for learning) and i'd like to know how to implement the tagging system. Are all the tags inserted into one single field ? If so, then how are they separated ? and how are the various sizes given to them ? Thanks, Link to comment https://forums.phpfreaks.com/topic/42807-tags-folksonomy/ Share on other sites More sharing options...
benjaminbeazy Posted March 15, 2007 Share Posted March 15, 2007 they are probably seperate fields, but if not explode() will do the trick to seperate them.. the different sizes are either random or a count of # of tags in table and thresholds are set, after a certain # it increases to this font size, etc. Link to comment https://forums.phpfreaks.com/topic/42807-tags-folksonomy/#findComment-207811 Share on other sites More sharing options...
.Darkman Posted March 15, 2007 Author Share Posted March 15, 2007 Could you tell me how to search the tags' occurrence in the DB For eg, I have one link : http://yahoo.com with tags : mail yahoo webmail <- this is one row I have another link : http://gmail.com with tags : gmail mail google <- this is one row So now, how do i find out that the tag "mail" is used twice ? bcoz all the tags go into one field. Thanks, Link to comment https://forums.phpfreaks.com/topic/42807-tags-folksonomy/#findComment-207818 Share on other sites More sharing options...
benjaminbeazy Posted March 15, 2007 Share Posted March 15, 2007 had to make a mod or 2, but this should search for multiple tags, seperated by commas might be a typo in there somewhere(tired) but you get the idea $search = $_POST['tags']; $searchtags = explode("," $search); $sql = array(); foreach($searchtags as $var => $val){ $string = "SELECT * from links WHERE tags LIKE '%$val%'"; array_push($sql, $string); } foreach($sql as $val => $val){ $result = mysql_query($val); // put your search results in here, or make another array or whatever } this is my half-assed attempt to get a count of all tags $sql = "SELECT tags from links"; $result = mysql_query($sql) or die(mysql_error()); $count = array(); while($row = mysql_fetch_object($result)){ $tags = explode(" ", $row->tags); foreach($tags as $var => $val){ $count[$val]++; } } Link to comment https://forums.phpfreaks.com/topic/42807-tags-folksonomy/#findComment-207831 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.