我试图从后面的代码中为我的所有页面更改SiteCore 8.0(更新3)中的布局.我正在使用布局解析器管道.我可以调试和查看更改的路径,但无法在UI上获得更新的布局.我通过谷歌搜索看到了各种各样的帖子,他们正在做同样的事情,但那些已经很老了(年龄大于2-3岁).
下面是我的布局解析器管道代码
public class LayoutResolver : HttpRequestProcessor
{
public LayoutResolver()
{
System.Diagnostics.Trace.WriteLine("PipeLine: ctor() has been called");
}
/// <summary>
/// Gets the layout for the page
/// </summary>
/// <param name="args"></param>
public override void Process(HttpRequestArgs args)
{
System.Diagnostics.Trace.WriteLine("PipeLine: This is atleast called");
Assert.ArgumentNotNull(args, "args");
if (!CanProcess())
{
return;
}
Context.Page.FilePath = "/Views/Shared/BusinessLayout_Two.cshtml";
}
private static bool CanProcess()
{
return Context.Database != null
&& !IsCore(Context.Database);
}
private static bool IsCore(Database database)
{
return database.Name == Constants.CoreDatabaseName;
}
}
Run Code Online (Sandbox Code Playgroud)
编辑:showconfig.config在配置中显示我的解析器寄存器.SiteCoreSample.Helpers.LayoutResolver是我的解析器.
<processor …Run Code Online (Sandbox Code Playgroud)