1
我有一个包含页眉和页脚信息的主布局。另外,我有使用特定渲染项目和主布局的页面。如果使用特定渲染项目的页面呈现,则应将主布局中的标题从默认标题值更改。Sitecore检查渲染项目是否初始化
这是我的伪代码。
namespace renderingItem1
public override void Initialize(Rendering rendering)
{
//code here
}
public string anotherMethod()
{
string str = "";
if (Initialized == true) {
str = "Rendering Item is called in this page";
}
return str;
}
// In another project, added 'renderingItem1.dll' into references in abother project
// this is masterLayout.cshtml
@using renderingItem1
@string pageTitle = "";
@if (redneringItem1.anotherMethod() is NOT empty) {
pageTitle = redneringItem1.anotherMethod();
}
在masterLayout.cshtml,它总是输出是str = ""
你应该发布你想实现的内容。我不知道你的代码应该做什么。 –
在@Marek会回复你第二个问题后,你会在这篇文章中添加更多的问题吗? :D –
@SitecoreClimber和Marek,我更新了,请让我知道你是否需要更多信息。 – Jay