简体   繁体   English

使用带有ASP.Net的Ektron CMS显示分类法中的数据

[英]Display data from taxonomy using Ektron CMS with ASP.Net

I am trying display the content from taxonomy by using Ektron CMS with ASP .Net 我正在尝试通过将Ektron CMS与ASP .Net一起使用来显示分类法的内容

By using the taxonomy path i got the id and trying to display the content. 通过使用分类法路径,我获得了ID并尝试显示内容。 But i am getting content as null. 但是我得到的内容为空。

Please let me know the possible solutions to solve this. 请让我知道解决此问题的可能解决方案。 Waiting for experts answers. 等待专家解答。

Thanks, 谢谢,

In my development environment, I have the following taxonomy: 在我的开发环境中,我具有以下分类法:

const string eventsTaxonomyPath = "\\Upcoming Events";
const long eventsTaxonomyId = 89;

It sounds like you already found this method (or something like it) in what I like to call the "Legacy API": 听起来您已经在我喜欢的“传统API”中找到了此方法(或类似方法):

var taxonomyApi = new Ektron.Cms.API.Content.Taxonomy();
var taxonomyId = taxonomyApi.GetTaxonomyIdByPath(eventsTaxonomyPath);

Without any info on what version you're on, I'll assume it's a recent (8.5+) version. 如果没有任何有关您所使用的版本的信息,我将假定它是最新版本(8.5+)。 The Framework API makes it really easy to get the content from a given taxonomy. Framework API使得从给定分类法中获取内容非常容易。 Below are a couple of ways that work on v9.0 and will most likely work in anything 8.5+ -- in the developer briefing webcast the only major change for the Framework API in v9 was the inclusion of the e-commerce namespace. 以下是在v9.0上可以使用的两种方法,并且很可能在8.5+上可以使用。在开发者简报网络广播中,v9中Framework API的唯一主要更改是包含了电子商务名称空间。

Getting the full taxonomy tree via the TaxonomyManager : 通过TaxonomyManager获取完整的分类树:

var taxonomyItemManager = new Ektron.Cms.Framework.Organization.TaxonomyManager();
var taxData = taxonomyItemManager.GetTree(eventsTaxonomyId, includeItems: true);

Getting all the content recursively from a given taxonomy folder via the ContentManager : 通过ContentManager从给定的分类文件夹中递归获取所有内容:

var contentManager = new Ektron.Cms.Framework.Content.ContentManager();
var criteria = new ContentTaxonomyCriteria();
criteria.AddFilter(eventsTaxonomyPath, true);
criteria.ReturnMetadata = true;
var content = contentManager.GetList(criteria);

The potential downside to the ContentManager way is that you lose the hierarchical taxonomy structure. ContentManager方式的潜在弊端是您失去了层次分类法结构。 The upside to using the ContentManager is that you can tell it to include all the metadata for each content block. 使用ContentManager的好处是,您可以告诉它包括每个内容块的所有元数据。 That's not possible with the TaxonomyManager or TaxonomyItemManager . 使用TaxonomyManagerTaxonomyItemManager不可能的。

My guess is that the "Get Content By Taxonomy" function you are using by default does not fetch the content. 我的猜测是,默认情况下,您使用的“通过分类法获取内容”功能不会获取内容。 You can either- 您可以-

a) Use the ID to get the content via the content manager API b) Investigate if the function you are using has an override to include content. a)使用ID通过内容管理器API获取内容b)调查您使用的功能是否具有覆盖内容的替代。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM