Hi, doing this is what midgard is for. Here's what you do:

<?

$topic = <insert topic guid>

$topic = mgd_get_object($topic);

$article = mgd_list_topic_articles_all($topic->id);

if ($article) for ($i=0, $article->fetch(),$i++) {

/* since you want to get the attchments as well, we must get the article
because the attachment id is not in the article object (is it hard to add
it? Wouldn't it be a good idea as most articles got somekind of attachment?)
*/
$art = mgd_get_article($article->id);
$att = $art->listattachments();
if (gettype($att) == "object") {
?>
<h1>&(art.title:h);</h1>
<img src=&(url);/images/&(att.id);
// I've defined $url so I can easily move my site to different hosts for
maintainance etc.
// for a howto on setting up the images dir (it's not dependant on the name,
it's just the one I use) se the manual
<p>&(art.content:h);</p>
?>
} else {
?>
<h1>&(art.title:h);</h1>
<p>&(art.content:h);</p>
<? }
}

This is a rough outline, f.x. you can apply different checks to the images,
and include more fields using the spesial midgard struct
&(objectname.fieldname:operator); where operator can be h, p, H, etc.

Hope this helps
Tarjei


> -----Original Message-----
> From: Vidar Berg [mailto:[EMAIL PROTECTED]]
> Sent: 8. mai 2001 13:59
> To: [EMAIL PROTECTED]
> Subject: [midgard-user] [midgad-user] How to get an image on
> the article
> list?
>
>
> Hi,
>
> On my root page I want an list over articles in topic 14,
> thats the news. I also want to put images in the articles,
> and I want those images to appear on the root page as well.
> Is there any easy way of doing this?
>
> Vidar
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to