Jump to content

Tags - Folksonomy


.Darkman

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.