> the pages vs articles thingy a few days ago. I have
> now managed to
> hack together something that serves articles from
> the topic
> structure as if they where pages. Really neat, and
> rather clean
> code thanks to the functions of argv/argc and active
> pages
> capabilities of midgard. 

Yep, I do the same thing and that's why I love it as
well :-)

> Now, I serve images attached to topics based on a
> virtual archive.
> If i have a uri "/xyxxy/files/img.png" the page code
> checks if 
> argv[argc - 2] == "files" and if that is true it
> tries to serve
> the attacment 'img.png' from the topic 'xyxxy'. Is
> that a good 
> solution, or is there a smarter way to serve
> attachments from
> articles? 

I suppose you're using Nadmin, only allowing you to
attach images to topics?  And you are typing in the
image locations manually in your html?

Maybe it's a good thing then to separate the
imagerequests-handling code and the
pagerequests-handling code by having just a separate
active page /files that analyses the URI (such as
"/files/xyxxy/img.png" - files comes first now) in
more or less the same way as your page-handling code
does, but then starting from "/files/" on, and serves
the img.png if it finds such a file attached to topic
xyxxy.

If you, on the other hand, are building your own
content admin interface, why would you mimic a
traditional file structure if it's not necessary?

I'm allowing my users to upload attachments connected
to articles (so not to topics) and all requests for
attachments are simple requests on one active page
with the attachment ID: (such as /attachment/2168)

the code of this page is:

<?php
 $attachment = mgd_get_attachment ($argv[0]);
 if ($attachment)
 {
   header("Content-disposition: attachment;
filename=".$attachment->title);
   mgd_serve_attachment($argv[0]);
 }
 exit();
?>


pascal

__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes
http://autos.yahoo.com

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

Reply via email to