Tarjei Huse wrote:
> I've tried a number of things to manage to get attachments. Basicly I've
> added attachments through the "add image" in fadmin. But: It is impossible
> to call them back! At lest it seems so.
>
> Does anyone have the code to get the attachments of an article, and display
> the file (gif or jpeg) in the listing. THis is a listing of articles and
> their abstracts, and I want to disply pitcures with the articles.
I have no intimate knowledge of fadmin, but I suppose this would work:
have a active page /displayarticle with content:
<?
if ($argc == 0) {
echo "No article selected" }
else { if (! ($article = mgd_get_article($argv[0]) ) {
echo "No article ", $argv[0];
} else {
?>
<H1>&(article.title);</H1>
&(article.abstract:f);<p>
>?
$att = $article->listattachments();
echo "<DL>"
while ($att && $att->fetch()) {
/* test $att->mimetype here if you're not sure that all attachments
are
images */
echo "<DT><IMG SRC=\"/displayarticle/", $argv[0], "/", $att->id,
"\">";
echo "<DD>", $att->title;
}
echo "</DL>";
}
?>
attach a page element 'code-init' with content:
<?
if ($argc == 2) { /* display blob */
mgd_serve_attachment($argv[1]);
exit;
}
?>
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]