Nesting Sitecore sublayouts/placeholders - possible?
Asked Answered
T

2

6

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.

Titian answered 12/7, 2012 at 3:48 Comment(0)
T
2

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.

Titian answered 12/7, 2012 at 7:26 Comment(2)
I was going to suggest the same thing. That's a good solution!Gustav
If the question isn't actually answered, why did you mark it as such?Pedicure
S
1

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.

Starr answered 27/8, 2013 at 1:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.