Orchard CMS:登录页面不适用于我的自定义布局

awr*_*ley 0 orchardcms

我对乌节来说很新.

我基于Minty主题创建了一个新主题.唯一真正的变化是布局,我从现有的asp.net主页调整了html以匹配果园风格的razor layout.cshtml.我有MVC和剃刀的经验,所以这方面没问题......除非我错过了一些重要的东西.

问题是登录页面.单击登录链接会将我带到正确的URL而不会出现错误,但不会呈现登录表单.我已经检查过谷歌浏览器中的Inspecting Element就是这种情况.

我知道设置小部件等,我可以让内容出现.但是,我无法找到在请求登录URL时如何插入登录表单.我认为它使用Orchard.Users模块,但不知道如何.它需要特定区域吗?我看不出原因,但看看怎么回事.

结果,我无法解决我的问题......

有什么指针吗?

任何书籍或其他学习媒体?

我的layout.cshtml的代码是:

@functions {
    // To support the layout classifaction below. Implementing as a razor function because we can, could otherwise be a Func<string[], string, string> in the code block following.
    string CalcuClassify(string[] zoneNames, string classNamePrefix) {
        var zoneCounter = 0;
        var zoneNumsFilled = string.Join("", zoneNames.Select(zoneName => { ++zoneCounter; return Model[zoneName] != null ? zoneCounter.ToString() : "";}).ToArray());
        return HasText(zoneNumsFilled) ? classNamePrefix + zoneNumsFilled : "";
    }
}
@{
    /* Global includes for the theme
    ***************************************************************/

    SetMeta("X-UA-Compatible", "IE=edge,chrome=1");
    Style.Include("http://fonts.googleapis.com/css?family=Handlee");
    Style.Include("http://html5shiv.googlecode.com/svn/trunk/html5.js");
    Style.Include("site.css");
    Script.Require("jQuery").AtHead();
    Script.Require("jQueryUI_Core").AtHead();
    Script.Require("jQueryUI_Tabs").AtHead();
    Script.Include("http://cdnjs.cloudflare.com/ajax/libs/modernizr/2.0.4/modernizr.min.js").AtHead();
    Style.Include("TagDefaults.css");
    Style.Include("LayoutStructure.css");
    Style.Include("LayoutStyling.css");
    Style.Include("TopMenu.css");
    Style.Include("LeftBlock.css");
    Style.Include("RightBlock.css");
    Style.Include("MenuAdapter.css");
    Style.Include("Content.css");
    Style.Include("FloatedBoxes.css");
    Style.Include("Helen.css");

    /* Some useful shortcuts or settings
    ***************************************************************/

    Func<dynamic, dynamic> Zone = x => Display(x); // Zone as an alias for Display to help make it obvious when we're displaying zones

    /* Layout classification based on filled zones
    ***************************************************************/

    //Add classes to the wrapper div to toggle aside widget zones on and off
    var asideClass = CalcuClassify(new [] {"Sidebar"}, "aside-"); // for aside-1, aside-2 or aside-12 if any of the aside zones are filled
    if (HasText(asideClass)) {
        Model.Classes.Add(asideClass);
    }

    //Add classes to the wrapper div to toggle tripel widget zones on and off
    var tripelClass = CalcuClassify(new [] {"TripelFirst", "TripelSecond", "TripelThird"}, "tripel-"); // for tripel-1, triple-2, etc. if any of the tripel zones are filled
    if (HasText(tripelClass)) {
        Model.Classes.Add(tripelClass);
    }

    //Add classes to the wrapper div to toggle quad widget zones on and off
    var footerQuadClass = CalcuClassify(new [] {"FooterQuadFirst", "FooterQuadSecond", "FooterQuadThird", "FooterQuadFourth"}, "split-"); // for quad-1, quad-2, etc. if any of the quad zones are filled
    if (HasText(footerQuadClass)) {
        Model.Classes.Add(footerQuadClass);
    }

    var slideshowClass = CalcuClassify(new[] {"HomeSlideshow"}, "slideshow-");
    if (HasText(slideshowClass)) {
        Model.Classes.Add(slideshowClass);
    }

    /* Inserting some ad hoc shapes
    ***************************************************************/

    //WorkContext.Layout.Header.Add(New.Branding(), "5"); // Site name and link to the home page
    //WorkContext.Layout.Footer.Add(New.BadgeOfHonor(), "5"); // Powered by Orchard
    WorkContext.Layout.Footer.Add(New.User(), "10"); // Login and dashboard links

    /* Last bit of code to prep the layout wrapper
    ***************************************************************/

    Model.Id = "layout-wrapper";
    var tag = Tag(Model, "div"); // using Tag so the layout div gets the classes, id and other attributes added to the Model
}

@tag.StartElement        
<a name="top"></a>
    <div id="SiteHeader">
        &nbsp;
    </div>
    <div id="PageContainer">
        <div style="position: absolute; Left:-80px; top:-88px;z-index:1000;">
            <img id="bird" title="Pheasant" src="/Themes/TheFarmsBlogs/Styles/Images/PositionedImages/pheasant.gif" />
        </div>

        <div class="SiteMenu"><p>Hello Menu</p></div>
        <div id="Specialized">  
        <div id="PageName">
            <!-- 
                PageName NOT in use!
             -->
        </div>

        @if (Model.RightColumn != null) {
        <div id="RightCol">
            @Zone(Model.RightColumn)
        </div>
        }
        <!-- Page divided into two main columns, of which the left column is subdivided as necessary -->
        <div id="LeftCol">
            <div id="PageBanner">
                <div id="PageBannerLeft">

                    @if (Model.MainImage != null) {
                    <div id="PageBannerImage">
                        @Zone(Model.MainImage)
                    </div>
                    }
                    @if(Model.TheStrip != null) {
                    <div id="TheStrip">
                        @Zone(Model.TheStrip)
                    </div>
                    }                   
                </div>
            </div>            
            <div id="SpecializedContent">
            @if(@Model.content != null)
            {
                @Zone(Model.content)
            }
            </div>
        </div>
        <div id="SpecializedFooter">
            &nbsp;
        </div>
    </div>

    <div id="PageFooter">
        &nbsp;
        @if (Model.FooterPage != null){ 
            @Zone(Model.FooterPage)
        }
    </div>
</div>
<div id="SiteFooter">
    @Display(Model.Footer)
    The Farms Ltd - &copy; 2007
</div>        
@tag.EndElement
Run Code Online (Sandbox Code Playgroud)

PS:品牌和荣誉徽章被注释掉了,因为我只是一点一点地消除了错误的来源.它将在现场.

附录:

请参阅下面的Bertrand Le Roy的回答.Orchard.Users模块需要一个带有Capital C的Content区域.这可以立即解决问题.

我添加了这个,因为Bertrand的回答是暂定的,我想强调问题是该区域的名称.

Ber*_*Roy 5

在Orchard.Users中,查找Controllers/AccountController.cs.在那里,有一个LogOn动作.它会创建一个LogOn形状,然后将其放入形状结果中.然后将其解析为Views/LogOn.cshtml模板(您可以通过删除其中具有相同名称的文件在您的主题中覆盖该模板,例如您可以调整的原始文件的副本).LogOn模板将在Content区域中的主题布局中呈现.这回答了你的问题了吗?

我认为您犯的错误是命名您的内容区域内容(注意外壳).