Monday, February 6, 2012

how to create breadcrumb in Ektron cms

Breadcrumbs are display at top of a web page ,which is provide the path for where we came from previously.breadcrumbs are set at the folder level, so we have to give them only for the main content block in the folder, Then breadcrumbs will automatically be set for the remaining of that folder’s content.
Ektron.Cms.API.Content.Content contentApi = new Ektron.Cms.API.Content.Content();
ContentData content = contentApi.GetContent(PageHost1.PageID);

if (content != null)
{
this.Master.ShowMetaTitle(content.Title);
long fid=content.FolderId;
Ektron.Cms.API.Folder folderApi = new Ektron.Cms.API.Folder();
FolderData folder = folderApi.GetFolder(fid);
if (folder == null)
return;
Ektron.Cms.Common.SitemapPath[] mapPath = folder.SitemapPath;
if (mapPath == null)
return;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < mapPath.Length; i++)
{
if (mapPath[i] == null)
continue;
if (sb.Length != 0)
sb.Append(" > ");
if (i < mapPath.Length - 1)
sb.AppendFormat("{1}",!String.IsNullOrEmpty(mapPath[i].Url) ? "/" + mapPath[i].Url : "/", mapPath[i].Title);
else
sb.Append(mapPath[i].Title);
}
BreadCrumb.Text = sb.ToString();
} 

1 comment:

Anonymous said...

Thanks for this post moreover ! Create websites you don't need to download any software. Creating Your Own Website within minute. CMS can also create straight websites, blogs, journals, news sites, educational and more…
http://www.zoomgi.com/

Bel