Skip to main content
Home  ›  Blog

Inner Content Blocks allow Details-Page Design (new in 8.4) - like Modules inside Modules

Since 2sxc 8.4 you can create content-blocks inside other content blocks. This allows you to create list/details scenarios and still use designed 2sxc-content block or even gallery apps inside the details-page.

Content Blocks Inside Content Items

Basically Content Blocks are 2sxc-modules...inside a normal Content-Item.

So you can insert content-blocks or app-blocks inside another 2sxc content-item and create complex pages. 


Template / View Code to Use Inner Content Blocks

<!-- blog content blocks -->
<div class="app-blog-text sc-content-block-list" @Edit.ContextAttributes(post, "DesignedContent")>
	@foreach(var cb in @post.DesignedContent) {

The Code Explained

This is what the code is all about

  1. A wrapper div - important so that the quick-insert knows into what container it should add new content-blocks. The special line @Content.DesignedContent.EditContext() will add some JSON when an editor is logged on to enable the in-page editing experience
  2. A loop, going through every every inner item
  3. ...and a Render() which then renders this item

Daniel Mettler grew up in the jungles of Indonesia and is founder and CEO of 2sic internet solutions in Switzerland and Liechtenstein, an 20-head web specialist with over 800 DNN projects since 1999. He is also chief architect of 2sxc (see github), an open source module for creating attractive content and DNN Apps.

Read more posts by Daniel Mettler