我正在关注有关 Wrappers 的 Orchard 文档,但无法理解它。 http://docs.orchardproject.net/Documentation/Understanding-placement-info#Wrapper
根据文档,我们Wrapper.HtmlContent.cshtml
将在其中创建并插入以下内容。
<div class="htmlWrapperContent">
@Model.Html
</div>
但什么是Model.Html
?是Shape
吗?我知道Model
是形状本身。不是orHtml
的内置属性,所以我认为它必须是通过代码完成的一些自定义属性,例如?Shape
IShape
shapeHelper.My_Shape(Html: "Hello World")
让我们从一开始就说明我正在努力实现的目标。我做了以下事情:
安置信息
<Placement>
<Place My_Shape="Content:before;Wrapper=My_Wrapper" />
</Placement>
我的.Shape.cshtml
<div class="myShape">
@* let's pretend that the line below prints "Hello World" *@
@Model.Html
</div>
我的.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
满足我的期望?