mgd_list_topic_articles_all

(Midgard 1.4.2 'Bifrost')

mgd_list_topic_articles_all -- List articles under topic tree

Description

object mgd_list_topic_articles_all (int topic, string [sort], int [type], int [up])

Minimum version: Midgard 1.1.1

Lists all articles that reside under the topic tree starting at topic with id topic. The optional parameter sort is used to sort the articles, and can be one of: "alpha", "reverse alpha", "name", "reverse name", "score", "reverse score", "calendar", "revised", "reverse revised". Default sort is by created date. 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.


<?php
  $topic = 123;
  $article = mgd_list_topic_articles_all( $topic, "score");
  if( $article->N == 0 ) {
    echo "No article";
  } else {
    while( $article->fetch() ) {
     echo $article->name . " by " . $article->authorname . "<br>\n";
    }
    echo "$article->N article", ($article->N == 1) ? '' : 's';
  }
?>