$object->getattachment

Name

$object->getattachment -- Get a record attachment

Synopsis

object $object->getattachment(int id);

Description

Minimum version: Midgard 1.4 (Bifrost)

Retrieves information about a record attachment by its id.

Returns an object describing the record attachment if successfull. Returns false on failure.

Method available for: article, element, event, event_member, group, host, member, page, pageelement, pagelink, person, preference, sitegroup, snippet, snippetdir, style and topic records.

Example

<?php
  $person = mgd_get_person(123); # person with id 123 must exist.
  $attid  = 13 ;                 # and have an attachment with id 13.
  if($attachment = $person->getattachment($attid)) {
    echo $attachment->name, $attachment->title ;
  } else {
    echo "Could not get attachment.<br>\n";
    echo "Reason: " .mgd_errstr();
  }
?>