Ektron Taxonomy Order with the API
Tuesday, October 26, 2010
If you have used the Ektron API to pull a branch from the CMS
Taxonomy tree, you may have noticed some unexpected results.
The taxonomy nodes are returned to you, ordered sequentially by the
id assigned to the node upon creation. Many times this order
will not differ from the order of the items in the Workarea (if the
default order has been preserved). However, often the CMS
admin will reorder the taxonomy into a specific order:
In the Workarea, under Modules -> Taxonomy -> {a specific
tax category}
You can right-click 'Reorder' and choose 'Items' from the
drop-down in the menu. This will allow an admin to order the
heirarchical display taxonomy items.
In this case, if you are pulling the taxanomy tree from the CMS
via the API, you will produce a different display order than the
Workarea. To display the taxonomy items in their proper
order, use the normal tax api but with SortOrder and
SortDirection...
Dim i As Integer
Dim TaxAPI As New Ektron.Cms.API.Content.Taxonomy
Dim TaxRequest As New Ektron.Cms.TaxonomyRequest
Dim TaxData As Ektron.Cms.TaxonomyData
'where taxid is the id of the taxonomy branch
TaxRequest.TaxonomyId = taxid
TaxRequest.TaxonomyLanguage = 1033
TaxRequest.IncludeItems = True
TaxRequest.Depth = 1
TaxRequest.SortOrder = "taxonomy_item_display_order"
TaxRequest.SortDirection = "Ascending"
TaxData = TaxAPI.LoadTaxonomy(TaxRequest)
If TaxData.TaxonomyItemCount > 0 Then
For i = 0 To TaxData.TaxonomyItemCount - 1
'whatever processing is desired
Next
End If
From Ektron 7.5.2 onward, the taxonomy sort is available via the
.SortOrder property.
Options are "date_created", "last_edit_date", "content_title",
and "taxonomy_item_display_order"
This entry was written by Administrator,
posted on Tuesday, October 26, 2010
Bookmark the permalink.
Follow any comments here with the
RSS feed for this post.
You can .