Razor 果园形包装纸

Razor 果园形包装纸,razor,orchardcms,orchard-modules,Razor,Orchardcms,Orchard Modules,我一直在关注关于包装纸的Orchard文档,但我无法理解它。 根据文档,我们要创建Wrapper.HtmlContent.cshtml,并在其中插入以下内容 <div class="htmlWrapperContent"> @Model.Html </div> My.Shape.cshtml <div class="myShape"> @* let's pretend that the line below prints "Hello Wo

我一直在关注关于包装纸的Orchard文档,但我无法理解它。

根据文档,我们要创建
Wrapper.HtmlContent.cshtml
,并在其中插入以下内容

<div class="htmlWrapperContent">
    @Model.Html
</div>
My.Shape.cshtml

<div class="myShape">
    @* let's pretend that the line below prints "Hello World" *@
    @Model.Html
</div>
<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">
    @Display(Model.Metadata.ChildContent)
</div>

@*让我们假设下面的一行显示“Hello World”*@
@Model.Html
My.Wrapper.cshtml

<div class="myShape">
    @* let's pretend that the line below prints "Hello World" *@
    @Model.Html
</div>
<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">
    @Display(Model.Metadata.ChildContent)
</div>

@*我应该在这里放什么*@
@*我试过以下方法*@
@* #1 *@
@Model.Html
@*显然这是可行的,但是为什么我要用包装器来做呢?我还不如在'My.Shape.cshtml'周围加上上面的'''*@
@* #2 *@
@显示器(型号)
@*这不起作用,因为循环引用。他自杀了*@
@* #3 *@
@显示子对象(模型)
@*由于'Model.\u items'为空,因此不会打印任何内容*@
我对页面外观的期望

<div class="htmlWrapperContent">
    <div class="myShape">
        Hello World
    </div>
</div>

你好,世界

所以我的问题是,
my.Wrapper.cshtml
应该如何满足我的期望?

在发布我的问题后不久,我在这里找到了答案

因此,包装器应该是

My.Wrapper.cshtml

<div class="myShape">
    @* let's pretend that the line below prints "Hello World" *@
    @Model.Html
</div>
<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">
    @Display(Model.Metadata.ChildContent)
</div>

@显示(Model.Metadata.ChildContent)
Orchard文档可能需要一些改进