Mailing List Archive

Creating related media from template
Hi,

I have a list of links that for user maintenance reasons I want to
convert to a list of related media.

But before I over task my brain by writing a template or script myself,
I thought I'd ask if anyone has done such a thing already.

If not, I'm thinking that the core steps would be:

Because the media are already stored in Bricolage,
Get the id of the media to be related
Call add_element to create a new container of type related_media
Save the new related_media element
Call set_related_media with the id of media to be related
Set the value of the link text field

Can someone tell me how far I am from the right path?

Thanks

gh
Re: Creating related media from template [ In reply to ]
On Sep 30, 2009, at 9:02 AM, Harrison, George (STEM) wrote:

> Because the media are already stored in Bricolage,
> Get the id of the media to be related
> Call add_element to create a new container of type related_media
> Save the new related_media element
> Call set_related_media with the id of media to be related
> Set the value of the link text field
>
> Can someone tell me how far I am from the right path?

Sounds about right. Have a look at the thumbnail-generating template
[example](http://github.com/bricoleurs/templates/blob/master/thumbnail.mc
), which first generates a media document, but then associates it with
the original media document as related media.

Best,

David