果园形包装纸
Orchard Shape Wrapper
我正在关注有关 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
应该是什么样子才符合我的预期?
发布问题后不久,我在这里找到了答案
Orchard - Wrappers for Fields
所以,包装器应该是
My.Wrapper.cshtml
<div class="htmlWrapperContent">
@Display(Model.Metadata.ChildContent)
</div>
Orchard 文档可以进行一些改进。
我正在关注有关 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
应该是什么样子才符合我的预期?
发布问题后不久,我在这里找到了答案
Orchard - Wrappers for Fields
所以,包装器应该是
My.Wrapper.cshtml
<div class="htmlWrapperContent">
@Display(Model.Metadata.ChildContent)
</div>
Orchard 文档可以进行一些改进。