SaaS CMS has officially launched! Learn more now.

Custom Rendering of Content Areas



Requirement is:

  • Pages of any page type can be dragged into content areas and displayed like blocks with the following properties from the page:

                                                               i.      heading 1

                                                             ii.      ingress

                                                            iii.      image.

                                      Shall: Use first image from body text

                                      Should: If no image in body text, look for image in block on the page.

So after publish, need to render pages and block with the properties mentioned above.

Dec 15, 2014 6:58

First I would recommend that you use the same names for your heading, ingress and image.

When you say "image in block on the page", do you mean the page that contains the Content Area?

Otherwise, rendering pages and blocks are standard functionality in EPiServer and how to do it is about the same.

Are you using MVC och WebForms?

Here is an article describing the basics of rendering content in EPiServer:

Ted also has a good blog post but it's based on MVC

Dec 15, 2014 8:31

Hi Alf,

Image in block on page means if there are 4 blocks in page dragged and dropped, then by looping in blocks to find image from the blocks.

Using MVC.

Thanks I will refer all these links.

Dec 15, 2014 9:19

Ah I think i see, so "shall" tries to pick an image added to the XHTML string from "ingress" while "should" use the image property as a fallback?

Dec 15, 2014 9:21

Shall: Use first image from body text means to find image from body text of a page

Should: If no image in body text, look for image in block on the page. means if no image found in body text, then loop from the blocks dragged on page and find first image from it.

Also I managed to do this, by creating a rendered by partial view :) and managed to get text properties.

Now will loop thru the blocks for images if no image found in body text of a page.

Dec 15, 2014 9:25
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.