Simon Lang
Simon Lang

Reputation: 42645

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.

Upvotes: 6

Views: 4882

Answers (2)

Keith D Ball
Keith D Ball

Reputation: 131

On a project I'm working on we had to do a similar thing.

We ended up using this solution: http://johnnewcombe.net/blog/post/17

Ripping the code out line for line doesn't work, but with a few modifications it worked for us... I added a comment to the article about what needed to be updated.

Upvotes: 1

Simon Lang
Simon Lang

Reputation: 42645

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.

Upvotes: 2

Related Questions