On 08.05.01 (13:58), Vidar Berg wrote:
> On my root page I want an list over articles in topic 14,

Lesson 1: Don't use absolute record id's in your code. In order
to keep your site portable (e.g., to use replication, staging or
other features that use repligard underneath), use names or
GUIDs (Globally Unique IDentifiers) for referral.

  $topic = mgd_get_topic_by_name(0, 'Foobar');

gives you the root topic named 'Foobar', for example, whereas

  $topic = mgd_get_object_by_guid('...');

works with _any_ object in _any_ position in the object trees.
The only way to obtain you objects' GUIDs, however, is to either
export your site with repligard or to have a look into the MySQL
database:

  select guid from repligard where id=? and realm=?;

helps there, with id being the record id and realm being its
type/table name (topic, article, page, ...).

> 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?

'easy' ... well, kind of ;-)  You'll spend a few hours to get it
working, I guess, but ...

First you need a page that displays your article attachments
which is how you store these images. A very rough guide to that
is provided as an annotation to 

  http://www.midgard-project.org/req/midgard-1.4/attachments.htm

To display those pictures in the root page, use some code like
that:

  while ($articles->fetch()) {
    # show article stuff ...
    $att = $article->listattachments(); 
    if ($att) while ($att && $att->fetch()) { 
      /* test $att->mimetype here if you're not sure that all
         attachments are images */ 
      ?><img src="hostname/img/&(att->id);" mimetype="&(att.mimetype);"><? 
    } 
  }

This code would show _all_ image attachments to an article -- is
you want to limit the number, use for instead of while.

     phr
-- 
Linksystem Muenchen GmbH                          [EMAIL PROTECTED]
Schloerstrasse 10                           http://www.link-m.de
80634 Muenchen                              Tel. 089 / 890 518-0
We make the Net work.                       Fax 089 / 890 518-77

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

Reply via email to