开发者

Layout based on Page - OrchardCMS

开发者 https://www.devze.com 2023-03-22 19:12 出处:网络
I have encountered an issue when using Orchard that I am sure there should be a fairly simple fix / solution for, but I have yet to find it.

I have encountered an issue when using Orchard that I am sure there should be a fairly simple fix / solution for, but I have yet to find it.

I am trying to establish a specific width content area for my home page (580px), and a larger width for content开发者_如何学JAVA pages (800px).

Layout.cshtml Snippet:

    <div id='content'>
        @Zone(Model.Content)
    </div>

Style:

    #Content
    {
        [...]
        width: 580px;
    }

Currently - the Content div wraps all of my content regardless of the page (either Home Page or Content). I am wondering if it is possible to use a different div to wrap the content based on the Page, as shown:

Layout.cshtml Idea:

@if(Model.Page != "Home")
{
    <div id='fullcontent'>
        @Zone(Model.Content)
    </div>
}
else
{
    <div id='content'>
        @Zone(Model.Content)
    </div>
}

I'm unsure if the above suggested method is possible (or I am unsure how to check for the current Page) - but any other suggestions would be appreciated.


You can use the Designer Tools module (built-in all recent Orchard versions) and enable the URL alternates feature. You'll then be able to create a layout-url-homepage.cshtml alternate for your layout.


You can use the Layout Selector Module to assign a custom layout to any content item.

http://gallery.orchardproject.net/List/Modules/Orchard.Module.Orchard.DesignerTools


You could use the Vandelay.Classy module to add custom tags to the page that represents your homepage, although it does add a lot of fields to the Page content editor.

0

精彩评论

暂无评论...
验证码 换一张
取 消