mgd_list_topic_articles
mgd_list_topic_articles -- List articles under topic
Description
object mgd_list_topic_articles` (int topic, string sort, int type, int up)
Minimum version: Midgard 1.1.1
Lists all articles that have their topic field set to topic. The optional parameter _sort _is used to sort the articles, and can be one of: "alpha", "reverse alpha", "created","reverse created", "name", "reverse name", "score", "reverse score", "calendar", "reverse calendar", "revised", "reverse revised". Default sort is by created date.
Default sort type is ASC , and reversed one is DESC.
Calendar = calstart + caldays and must be set while editing the article (i.e. it is not calculated from created or revised).
For score and reverse score, there is a secondary sorting on title:Â article.score (ASC|DESC) , article.title ASC.
The optional parameter type can be used to filter articles. Default value is no filter. The optional parameter up can be used to select articles by their up field (this is available in Midgard 1.4.1 (Bifrost)).
Returns an object traversable by calling fetch() if successful. Returns FALSE on failure.
$topic = 123;
$article = mgd_list_topic_articles( $topic, "score" );
if ( $article->N == 0 ) {
echo "No article";
} else {
while ( $article->fetch() ) {
echo $article->name . "
\n";
}
echo "$article->N article", ( $article->N == 1 ) ? '' : 's';
}
?>
