You can create a HTML block in child view first and then pass it to parent (layout):
@sidebar = {
<div>MySidebar</div>
}
@parent(sidebar){
<div>Main content of the child view</div>
}
So in parent.scala.html
layout you will use it just like
@(sidebar: Html = null)(content: Html)
<div id="parent-wrap">
@sidebar
@content
</div>
Of course if you gonna to use the same HTML code for many subpages you'll do better if you use a tag instead of declaring @sidebar
block in each view. Remember that tag is nothing more then just a scala view (template) and you can include it as any other view. Just create a normal view in app/views/tags
i.e.: sidebar.scala.html
with required HTML block, so you can later use it somewhere like:
<div class="span3">@tags.sidebar("content to pass")</div>
or as a block passed to higher level layout, etc :
@parent(tags.sidebar(additionalContent)){
<div>Main content of the child view</div>
}
TBH I never knew what's the difference between including views and tags ;)