简体   繁体   中英

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

By using the taxonomy path i got the id and trying to display the content. 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":

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. The Framework API makes it really easy to get the content from a given taxonomy. 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.

Getting the full taxonomy tree via the 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 :

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. The upside to using the ContentManager is that you can tell it to include all the metadata for each content block. That's not possible with the TaxonomyManager or TaxonomyItemManager .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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