Custom Rendering of Content Areas

Vote:
 

Hi,

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.

#114515
Dec 15, 2014 6:58
Vote:
 

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:

http://world.episerver.com/blogs/Johan-Bjornfot/Dates1/2012/9/EPiServer-7--Rendering-of-content/

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

http://tedgustaf.com/blog/2013/10/how-to-render-pages-in-a-content-area/

#114521
Dec 15, 2014 8:31
Vote:
 

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.

#114527
Dec 15, 2014 9:19
Vote:
 

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?

#114528
Dec 15, 2014 9:21
Vote:
 

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.

#114529
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.