Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Blog post image. View modes: 
User avatar
Member
Member
denprog-rbntech - 1/15/2011 5:14:00 PM
   
Blog post image.
Hello!

Required to implement to following if blog post teaser is empty, then get image from blog teaser of the bloger.

I wrote to support, they recommended to create custom function to transformation, but I don't know what write in function.

In the transformation I wrote the next
<%# IfEmpty(Eval("BlogPostTeaser"), "", GetImage("BlogPostTeaser", 200)) %>

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/17/2011 4:09:53 AM
   
RE:Blog post image.
Hello,


The BlogTeaser is not a field of Blog post document type so that you cannot use the Eval("BlogTeaser") directly. You can create a custom transformation function (Custom transformation function) and find the parent document of parent document of the current one to get the data of Blog document (to get the BlogTeaser value). The structure is:

Blog document -> Blog month document -> Blog post document

You can find the parent of a document by NodeId which is stored in NodeParentNodeId field of any document. The sample code is here: Selecting nodes by API


Best regards,
Helena Grulichova