Nested layouts

36 views
Skip to first unread message

Artem Smirnov

unread,
Dec 23, 2014, 2:46:05 PM12/23/14
to spar...@googlegroups.com
Hi,

I'm trying to use nested layouts in my FubuMVC application. For some reason, I see only the 2nd level master, but not the topmost one.

\Shared\Content.spark:
<!-- Content.spark -->
<main class="container">
	<use:view />
</main>

(also tried placing <use master="Application"/> at the top)

Output:
<!-- Content.spark -->
<main class="container">
(...)
</main>

How do I make Content.spark use the Application.spark master?

Artёm

Robert Greyling

unread,
Dec 24, 2014, 4:59:59 AM12/24/14
to spar...@googlegroups.com
Hi Artem,

There are a few things that cloud the issue for me. Not sure what your <main> tag is - is that a partial or a Binding of some kind? Also, I'm not sure if nested layouts are supported in the Fubu side since that code was revamped a few times as the framework changed since I only did the original implementation.

Have you tried using partials instead of layouts to test your nesting?

I would need to see a fair bit more code before I had any idea if yours had issues I could spot.

Hope that helps,
Rob


--
You received this message because you are subscribed to the Google Groups "Spark View Engine Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spark-dev+...@googlegroups.com.
To post to this group, send email to spar...@googlegroups.com.
Visit this group at http://groups.google.com/group/spark-dev.
For more options, visit https://groups.google.com/d/optout.

Artem Smirnov

unread,
Dec 24, 2014, 5:17:49 AM12/24/14
to spar...@googlegroups.com
"main" is just an html5 tag. Changing it to "div" haven't changed anything.

Here's my page's code:
<viewdata model="ChpokkWeb.Features.ReadMe.ReadMeModel" />
<use namespace="ChpokkWeb.Features.ReadMe" />
<use master="Content" />
!{Model.Title}

Both Content.spark and Application.spark are in the /Shared folder. I can see that my page uses Content.spark, but the latter won't use Application.spark. Not sure I understand how to test my nesting using partials.

What's the canonical way of using nested layouts in Spark? How does the 2nd level master look like?

Robert Greyling

unread,
Dec 24, 2014, 6:04:17 AM12/24/14
to spar...@googlegroups.com
Hi Artem,

You can look here for the canonical way of using Layouts: https://github.com/SparkViewEngine/spark/wiki/Master-Layouts

I'm not exactly sure how much of that Fubu actually implements, but in my eyes, the theory is that you should able to put a tag in your Content.spark that says <use master"Application" /> and it should render Application --> Content --> View

Again, I'm not 100% sure Fubu has implemented that, but I would hope it works out the box as long as the views are located by Fubu and presented to Spark correctly.

Hope that helps,
Rob

Artem Smirnov

unread,
Dec 24, 2014, 6:56:27 AM12/24/14
to spar...@googlegroups.com
Hi Rob,

I think my problem was that I first had the 2nd level master one folder level up, and it was picking it rather than the one in the \Shared folder

So finally it worked for me, just like you said:

<use master="Application" />
<!-- Content.spark -->
<div class="container">
	<use:view />
</div>

Thanks a lot for your help!

Artem

Robert Greyling

unread,
Dec 24, 2014, 7:09:53 AM12/24/14
to spar...@googlegroups.com
No probs, glad it worked :)
Reply all
Reply to author
Forward
0 new messages