Friday, April 4, 2008

How To activate Related Links In Pligg

This tutorial explains how to activate related links in Pligg

  • First of all You need to use URL method 2 to work this properly
  • Secondly go to libs/html1.php file and edit function related_stories function. replace with below code.
  • Note : This is working fine with my website Indiantags.com
  • If you are still facing problems in resolving this issue follow this thread
  • activating related Links
  • You can give me comment so that i can help you
 function related_stories($storyid, $related_tags, $category){
// this returns similar stories based on tags in common and in the same category
global $db;
$related_tags="'".str_replace(",","', '",addslashes($related_tags))."'"; // This gives us the proper string structure for IN SQL statement

// Select 10 stories that share tags with the current story and order them by number of tags they share
$sql = "SELECT ".table_links.".link_title, ".table_links.".link_title_url, COUNT( ".table_tags.".tag_link_id ) AS relevance, ".table_tags.".tag_link_id FROM ".table_tags.", ".table_links." WHERE ".table_tags.".tag_words IN ( ".$related_tags." ) AND ".table_tags.".tag_link_id = ".table_links.".link_id AND ".table_links.".link_status != 'discard' AND ".table_links.".link_id != ".$storyid;
$sql.= " GROUP BY ".table_tags.".tag_link_id, ".table_links.".link_title, ".table_links.".link_title_url ORDER BY relevance DESC LIMIT 10";

$related_story = $db->get_results($sql);
$related_story = object_2_array($related_story);
return $related_story;
}

No comments: