Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nesting Sitecore sublayouts/placeholders - possible?

I have a Sublayout called TwoColumns that looks like this:

<div class="row">
    <div class="column span8"><sc:placeholder runat="server" key="left-column"></sc:placeholder></div>
    <div class="column span4"><sc:placeholder runat="server" key="right-column"></sc:placeholder></div>
</div>

I would usually add other sublayouts through my presentation details, and specify the placeholder as left-column or right-column.

Now, say I want the exact same proportion columns but WITHIN the left column. As such:

enter image description here

I could add the TwoColumns sublayout to the left-column... but if I want to add something to one of those nested placeholders, how do I do that? Is it possible to set "left-column left-column" as the placeholder?

What about if I want a second ROW of TwoColumns? How can I specify whether I want my content to go in the first row's left-column, or the Nth row's left-column? Is Sitecore even capable of this by default?

Please note "Just create a new sublayout called NestedTwo columns" is not the solution I'm looking for. I'd like a flexible grid system.

Don't worry about the CSS grid system, that is done. This is a purely Sitecore question.

like image 413
captainclam Avatar asked Jul 12 '12 03:07

captainclam


People also ask

How to add placeholder in Sitecore?

To add a placeholder setting for a site: Navigate to the Presentation folder of your site, right-click Placeholder Settings, click Insert, and then click Placeholder. Enter a name and click Ok.

What is Sitecore dynamic placeholder?

Dynamic placeholders mean that: Unique keys are guaranteed across different renderings and within one rendering. You can build functionality that generates multiple placeholders within the same rendering dynamically.

What are Sublayouts in Sitecore?

In older Web Forms implementations of Sitecore, components are created using . ascx sublayout files. They act as movable, reusable components that can also be nested inside placeholders.


Video Answer


1 Answers

This article is a really good start:

http://trueclarity.wordpress.com/2012/06/19/dynamic-placeholder-keys-in-sitecore/

With the above I can use the same sublayout (with the dynamic key placeholders) multiple times, which is great. However I've found you can't NEST them, so it doesn't actually solve my original problem.

like image 163
captainclam Avatar answered Nov 08 '22 20:11

captainclam