我正在关注Wrappers上的Orchard文档,但无法绕过它。 http://docs.orchardproject.net/Documentation/Understanding-placement-info#Wrapper
根据文档,我们要创建Wrapper.HtmlContent.cshtml
并在其中插入以下内容。
<div class="htmlWrapperContent">
@Model.Html
</div>
但是Model.Html
是什么?是Shape
吗?我知道Model
是形状本身。 Html
不是Shape
或IShape
的内置属性,因此我认为它必须是通过代码完成的一些自定义属性,例如shapeHelper.My_Shape(Html: "Hello World")
?
<小时/> 让我们从头开始,说明我想要实现的目标。我做了以下事情:
Placement.info
<Placement>
<Place My_Shape="Content:before;Wrapper=My_Wrapper" />
</Placement>
My.Shape.cshtml
<div class="myShape">
@* let's pretend that the line below prints "Hello World" *@
@Model.Html
</div>
My.Wrapper.cshtml
<div class="htmlWrapperContent">
@* what should I be putting here? *@
@* I have tried the following *@
@* #1 *@
<div class="myShape">
@Model.Html
</div>
@* Obviously this works but then why would I use a wrapper to do this? I might as well just surround `My.Shape.cshtml` with `<div class="htmlWrapperContent"></div>` above. *@
@* #2 *@
@Display(Model)
@* This doesn't work because circular reference. IIS killed itself. *@
@* #3 *@
@DisplayChildren(Model)
@* Since `Model._items` is empty, this doesn't print anything. *@
</div>
我希望页面看起来像
<div class="htmlWrapperContent">
<div class="myShape">
Hello World
</div>
</div>
所以我的问题是,My.Wrapper.cshtml
应该如何满足我的期望?
答案 0 :(得分:0)
在发布我的问题后不久,我在这里找到了答案
所以,包装器应该是
<强> My.Wrapper.cshtml 强>
<div class="htmlWrapperContent">
@Display(Model.Metadata.ChildContent)
</div>
Orchard文档可以使用一些改进。