In my implementation of Pligg (v9.5), my tags are separated by a space (not by a comma). So, the related stories tab is empty.
Can someone advise as to what needs to be changed in the code to make it work?
I suspect the function added to the html1.php file needs to be changed. Here it is:
---
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))."'"; //
// 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 NOT ".table_links.".link_id = ".$storyid;
//comment the following line out if you want this to work accross categories
//$sql.= " AND ".table_links.".link_category = ".$category;
$sql.= " GROUP BY ".table_tags.".tag_link_id, ".table_links.".link_title, ".table_links.".link_title_url ORDER BY relevance DESC LIMIT 10";
$related_stories = mysql_query($sql);
$related_story = array();
while ($rows = mysql_fetch_array ($related_stories, MYSQL_ASSOC)) array_push ($related_story, $rows);
return $related_story;
}
---
Thx
-A




Linear Mode




