我对Orchard很陌生。
我已经创建了一个新的主题,基于Minty主题。唯一真正的变化是布局,我调整了现有asp.net母版页中的html以匹配果园风格的剃刀layout.cshtml。我有使用MVC和剃刀的经验,所以在这方面没有问题…除非我错过了什么重要的东西。
问题出在登录页面上。单击登录链接将我带到正确的url,没有错误,但不会呈现登录表单。我已经通过检查google chrome中的元素确认了这一点。
我知道,设置窗口小部件等,我可以让内容出现。但是,当请求登录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">
</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">
</div>
</div>
<div id="PageFooter">
@if (Model.FooterPage != null){
@Zone(Model.FooterPage)
}
</div>
</div>
<div id="SiteFooter">
@Display(Model.Footer)
The Farms Ltd - © 2007
</div>
@tag.EndElementPS:荣誉的品牌和徽章被注释掉了,因为我只是一点一点地使能消除错误的根源。它将出现在实时站点中。
附录:
请看伯特兰·勒罗伊的回答。Orchard.Users模块需要一个带有大写C的内容区,这立即解决了问题。
我添加了这一点,因为Bertrand的反应是试探性的,我想强调问题出在专区的名称上。
发布于 2012-05-18 02:28:01
在Orchard.Users中,查找控制器/AccountController.cs。在那里,有一个LogOn操作。它创建一个LogOn形状,然后将其放入shape结果中。然后将其解析为Views/LogOn.cshtml模板(您可以在主题中覆盖该模板,只需将具有相同名称的文件放入其中,例如,您可以调整原始文件的副本)。LogOn模板将呈现在主题布局中的内容区域中。这回答了你的问题吗?
我认为你犯的错误是命名你的内容区内容(注意大小写)。
https://stackoverflow.com/questions/10626615
复制相似问题