Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Access first attachment from doc transformation View modes: 
User avatar
Member
Member
Krotki - 2/4/2010 5:19:50 AM
   
Access first attachment from doc transformation
Hi,

I'd like to create article transformation, where teaser is added as first attachment. How can I do this in document transformation ?

Is it possible to attach image from media library to document ?

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 2/4/2010 8:04:45 AM
   
RE:Access first attachment from doc transformation
Hello,

I am not truly shure, what you are trying to accomplish. If you want to display an attachment of the document which you are displaying in a transformation you can use the following code:

<%# GetAttachmentUrl("NewsPhoto1.jpg","/News/Your-first-news") %>
• Inserts URL of the attachment with name specified in the first parameter of the document with nodeAliasPath specified by the second one. This method returns the same URL as GetFileUrl, but needn't load the whole document, which results in better performance.

Currently it is not possible to attach images from the medial library.

Best regards,
Boris Pocatko

User avatar
Member
Member
Krotki - 2/4/2010 11:02:35 AM
   
RE:Access first attachment from doc transformation
Hmmm I'd like to refer to the attachment by it's position in tree - not by the name.

For istance I'd like to create an article without any photos in content. Then add images as attachment. Article teaser would be the first attachent so moving images up/down I can select given document. All images would be shown in attachment image gallery webpart. In this way I don't need to know the image name.

Maybe inserting nested repeater and constructing proper query is a solution ...

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 2/9/2010 9:56:12 AM
   
RE:Access first attachment from doc transformation
Hello,

I am not sure how to achieve that with a nested repeater. I would suggest you to use a custom function in the transformation and retrieve the data you need. For more information about custom functions in transformations please follow the attached link:

http://devnet.kentico.com/docs/devguide/index.html?adding_custom_functions_to_transformations.htm

Best regards,
Boris Pocatko