Ken Pooley wrote:

> In the function reference at the bottom of the page it lists the next and 
> last article...how does it do that? Do the articles have to be numerically 
> sequential?

Nope. In the function reference the navigational links are generated
from the SGML source; the online pages simply import & display these
generated files.

For articles from the database we use a simple 'brute force' approach:
list the articles in any chosen order and look for the current article
id. Given the current article id is $argv[0]:

$prev = 0;
$next = 0;

$article = mgd_get_article($argv[0]);
$cursor = mgd_list_topic_articles($article->topic, "sort order you want");
while ($cursor && $cursor->fetch() && $cursor->id != $article->id) {
   $prev = $cursor->id;
}

if ($cursor && $cursor->id == $article->id && $cursor->fetch()) {
   $next = $cursor->id;
}

$prev and $next will hold the previous and next articles, or be 0 if
none such exist.

Emile


--
This is The Midgard Project's mailing list. For more information,
please visit the project's web site at http://www.midgard-project.org

To unsubscribe the list, send an empty email message to address
[EMAIL PROTECTED]

Reply via email to