Kentico CMS 6.0 Tutorial  

Web part containers

Web part containers

Previous topic Next topic Mail us feedback on this topic!  

Web part containers

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

Web parts or widgets can be configured to display only their own content or they can be rendered within a "container". The container consists of HTML code that is placed before and after the web part.

 

Switch to CMS Desk, select Home and click Live site. The Newsletter subscription widget uses the Black box container:

 

With container:

 

tutorial_clip0062

 

Without container:

 

tutorial_clip0063

 

Container are useful when you need to organize the page layout into separate boxes. You can choose a container for web parts or widgets when you configure their properties.

 

The containers can be edited in the Site Manager -> Development -> Web part containers section.

 

tutorial_clip0064

 

Here's an example of the Black box container code:

 

HTML before web part:

 

<div class="blackBox">
 <h2 class="title">{%ContainerTitle%}</h2>
 <div class="content">

 

HTML after web part:

 

 </div>
</div>

 

As you can see the container is composed of simple HTML code. Div or Table elements can be used together with CSS classes to implement the container. The CSS classes may either be defined in the site stylesheet or locally in the CSS styles field.

 

The {%ContainerTitle%} macro expression indicates where the container title should be displayed. The text of the title may be specified when configuring the properties of a web part and it is dynamically resolved when the web part is displayed.