肯蒂科的页面列表
List of pages in Kentico
在我的 Kentico 站点中,我有一个页面包含指向其他页面的链接列表。再说文章。我的 aspx 页面上有一个转发器,下面的代码填充了它。
它有效,但我认为这是一种黑客攻击。有更好的方法吗?
protected void Page_Load(object sender, EventArgs e)
{
var dataSource = DocumentHelper.GetDocuments("custom.CustomPressRelease")
.Select(x => new
{
Link = GetUrl(x),
PublishFrom = x.GetValue("DateIssued"),
Title = x.GetValue("ContentTitle"),
Teaser = x.GetValue("TeaserText"),
GeoCoverage = x.GetValue("GeoCoverage")
})
.OrderByDescending(x => x.PublishFrom);
Repeater.DataSource = dataSource;
Repeater.DataBind();
}
嗯,是什么让您认为这是黑客攻击?这就是您以编程方式执行此操作的方式。如果您想使用 portal engine 实现相同的目的,您可以添加转发器 web 部件,设置它的过滤器和转换,然后就完成了。或者您可以使用基本转发器 Web 部件并将其绑定到页面数据源。
您还可以组合 ASPX 模板 + 门户引擎方法 - 您仍然可以拥有 ASPX 页面并使用内置的 Web 部件(转发器、基本转发器、数据源...)它们是标准的 ASCX 控件.您只需要正确设置它们。应该没有问题,属性通常1:1与你在门户引擎中看到的一样。
没有破解您发布的内容。在 documentation here 和 ObjectQuery
此处的文档它还显示了另一种获取信息的方法:
// Creates an instance of the Tree provider
TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);
// Gets the published version of pages stored under the "/Articles/" path
// The pages are retrieved from the Dancing Goat site and in the "en-us" culture
var pages = tree.SelectNodes()
.ClassNames("custom.CustomPressRelease")
.Path("/Articles/", PathTypeEnum.Children)
.WhereLike("DocumentName", "Coffee%")
.Columns("NodeAliasPath", "DateIssued", "ContentTitle", "TeaserText", "GeoCoverage")
.OnSite("DancingGoat")
.Culture("en-us");
在我的 Kentico 站点中,我有一个页面包含指向其他页面的链接列表。再说文章。我的 aspx 页面上有一个转发器,下面的代码填充了它。 它有效,但我认为这是一种黑客攻击。有更好的方法吗?
protected void Page_Load(object sender, EventArgs e)
{
var dataSource = DocumentHelper.GetDocuments("custom.CustomPressRelease")
.Select(x => new
{
Link = GetUrl(x),
PublishFrom = x.GetValue("DateIssued"),
Title = x.GetValue("ContentTitle"),
Teaser = x.GetValue("TeaserText"),
GeoCoverage = x.GetValue("GeoCoverage")
})
.OrderByDescending(x => x.PublishFrom);
Repeater.DataSource = dataSource;
Repeater.DataBind();
}
嗯,是什么让您认为这是黑客攻击?这就是您以编程方式执行此操作的方式。如果您想使用 portal engine 实现相同的目的,您可以添加转发器 web 部件,设置它的过滤器和转换,然后就完成了。或者您可以使用基本转发器 Web 部件并将其绑定到页面数据源。
您还可以组合 ASPX 模板 + 门户引擎方法 - 您仍然可以拥有 ASPX 页面并使用内置的 Web 部件(转发器、基本转发器、数据源...)它们是标准的 ASCX 控件.您只需要正确设置它们。应该没有问题,属性通常1:1与你在门户引擎中看到的一样。
没有破解您发布的内容。在 documentation here 和 ObjectQuery 此处的文档它还显示了另一种获取信息的方法:
// Creates an instance of the Tree provider
TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser);
// Gets the published version of pages stored under the "/Articles/" path
// The pages are retrieved from the Dancing Goat site and in the "en-us" culture
var pages = tree.SelectNodes()
.ClassNames("custom.CustomPressRelease")
.Path("/Articles/", PathTypeEnum.Children)
.WhereLike("DocumentName", "Coffee%")
.Columns("NodeAliasPath", "DateIssued", "ContentTitle", "TeaserText", "GeoCoverage")
.OnSite("DancingGoat")
.Culture("en-us");