Skip to content

Instantly share code, notes, and snippets.

@jhorsman
Last active January 3, 2016 08:29
Show Gist options
  • Save jhorsman/8436700 to your computer and use it in GitHub Desktop.
Save jhorsman/8436700 to your computer and use it in GitHub Desktop.
Fiddling with Tridion CD Taxonomies...
mytax.TaxonomyFilter =
new DepthFilter(DepthFilter.UnlimitedDepth, DepthFilter.FilterDown);
TaxonomyFactory tf = new TaxonomyFactory();
CompositeFilter filter = new CompositeFilter();
filter.DepthFiltering(2, DepthFilter.FilterDown);
Keyword root = tf.GetTaxonomyKeywords("tcm:69-269-512", filter, "tcm:69-2421-1024");
taxonomyOutput.Text += "root keyword: " + root.KeywordName + "<br/>";
foreach (Keyword child in root.KeywordChildren)
{
taxonomyOutput.Text += "<li>" + child.KeywordName + "</li>";
}
if (!String.IsNullOrEmpty(Request.Params["Keyword"]))
{
TaxonomyFactory taxonomyFactory = new TaxonomyFactory();
Keyword selectedKeyword = taxonomyFactory.GetTaxonomyKeyword(Request.Params["Keyword"]);
Keyword[] selectedKeywords = { selectedKeyword };
ComponentPresentationFactory presentationfactory = new ComponentPresentationFactory(7);
ComponentPresentation[] componentPresentations = presentationfactory.GetTaxonomyComponentPresentations(selectedKeywords, "tcm:69-6306-32", true);
foreach (ComponentPresentation cp in componentPresentations)
{
taxonomyOutput.Text += cp.Content;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment