sorting the {RELATED} tag
Posted: Wed 22. Sep 2004, 09:58
I'm trying to include a list of related articles based on a particular keyword. The tag I'm using is {RELATED
California}. The problem, is that the related links seem to be sorting based upon the last edit time of each article. Is there a way to sort the results of a related tag alphabetically? It seems that a minor change to the code at line 391 of content.func.inc.php should be able to change what results are sorted on.
Thanks for any help!
Code: Select all
// related articles based on keywords, inspired by Magnar Stav Johanssen
if( ! ( strpos($content["all"],'{RELATED:')===false ) ) {
if (!$no_content_for_this_page && $content["articles"][$aktion[1]]["article_keyword"]) {
$related_keywords = $content["articles"][$aktion[1]]["article_keyword"];
}
$content["all"] = preg_replace('/\{RELATED:(\d+)\}/e','get_related_articles($related_keywords,$aktion[1],$template_default["related"],"$1",$db);',$content["all"]);
$content["all"] = preg_replace('/\{RELATED:(\d+):(.*?)\}/e','get_related_articles("$2",$aktion[1],$template_default["related"],"$1",$db);',$content["all"]);
}