mgd_create_article

(Midgard 1.4.2 'Bifrost')

mgd_create_article -- Create a new article

Description

int mgd_create_article (int up, int topic, string name, string title, string abstract, string content, int author, string url, string calstart, int caldays, int icon, int view, int print, string extra1, string extra2, string extra3, int type)

Creates a new article. To create an article in a topic, the user must be in the topic's owner group.

Returns the id of the created article if successful. Returns FALSE on failure.


<?php
 $up       = 123;
 $topic    = 17;
 $name     = "Demo Article";
 $title    = "What's in a name";
 $abstract = "Learning Midgard from the manual is easy, but...";
 $content  = "Learing Midgard from the manual is easy, but by actually trying ";
 $content .= "the examples yourself, you'll get a better feel for what is ";
 $content .= "the use of the various functions.";
 $author   = 17;
 $url      = "http://www.midgard-project.org/";
 $calstart = "0000-00-00";
 $caldays  = 0;
 $icon     = 0;
 $view     = 0;
 $print    = 0;
 $extra1   = "";
 $extra2   = "";
 $extra3   = "";
 $type     = 0;

 mgd_errno();
 $article = mgd_create_article( $up, $topic, $name, $title, $abstract, $content,                                $author, $url, $calstart, $caldays, $icon,
                                $view, $print, $extra1, $extra2, $extra3,
                                $type);
 if( ! $article ) {
        echo "Creation of article '$name' failed.<br>\n";
        echo "reason: " . mgd_errstr();
 } else {
        echo "Created article '$name' with id " . $article;
 }
?>

See also mgd_create_topic().