Try our conversational search powered by Generative AI!

Displaying data from child page ContentArea

A
A
Vote:
 

Hi, am new new episerver cms - using version 11.

I have the following page structure in my procject:

+Root

   + Home

   + Landing Page

      + Sub Page ( of Landing Page )
      + Sub Page ( of Landing Page )

On my SubPage Type,  I have a 'Sections' property that i iterate through in the view. 

AllowedTypes(typeof(HeadingAndTextBlock))]
public virtual ContentArea Sections { get; set; }

The blocks have been added to the ContentArea section only.

My question(s) are:

  • How do I create links to blocks in other pages of the site and managed them in the cms?
  • On the Landing Page, how do I manage the content shown based on the blocks already created in the Sub Page(s) ContentArea property?

[Headig and Text Block]

[ContentType]
public class HeadingAndTextBlock : BlockData
{

[Display(Name = "Heading",
GroupName = SystemTabNames.Content)]
public virtual XhtmlString Heading { get; set; }


[Display(Name = "Sub Heading",
GroupName = SystemTabNames.Content)]
public virtual XhtmlString SubHeading { get; set; }


[Display(Name = "Bullet Points",
GroupName = SystemTabNames.Content)]
public virtual XhtmlString TextContent { get; set; }
}



[Page Type]

public class SubPage : GlobalBasePage
{
        
    [Display(Name = Global.Pages.SubPage.SUB_PAGE + " Sections")]
        [AllowedTypes(typeof(HeadingAndTextBlock))]
        public virtual ContentArea Sections { get; set; }
         
}
[ContentType(DisplayName = Global.Pages.LandingPage.LANDING, GroupName = SystemTabNames.Content)]
public class LandingPage : GlobalBasePage
{

[Display(Name = "Sub Page Links/References")]
[AllowedTypes(typeof(HeadingAndTextBlock), RestrictedTypes = new[] { typeof(HeadingAndTextBlock) })]
public virtual ContentReference Reference { get; set; }



/*  This is where im tring to link to other blocks in the sub page ^^   */

}



#187647
Edited, Jan 30, 2018 19:37
A
Vote:
 

I ended up moving the page blocks over to a global file structure, not sure how right this is but it does work for now.

Can anyone tell me if this is the only way to reference other page data in a 'manged' way?

#187651
Jan 30, 2018 21:20
* 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.