After several years of EPiServer development on a variety of projects, I have found myself and other team members solving the same basic web CMS problems over and over again. Page list? Menu with multiple levels? Bread crumb menu? They and other code tends to be written over and over again, often copied and slightly changed. After a while it gets quite boring, solving common problems over and over again, and trying to maintain different versions with their idiosyncrasies. The BreadCrumbs control in the EPiServer Public Templates is a good example, 120 lines of code behind code which solves a common but slightly specific problem. The ideal way to do it would be to tell a standard bread crumbs web control what it should look like, and leave the rest to the control.
These issues are what I am trying to address with a new open source project that I have just released, EPiUtilities. The idea is to create a library of commonly used EPiServer functionality which easily can be included and used in an EPiServer project, but does not interfere with your project unless you explicitly use it. It will be available on the EPiServer nuget feed when it clears moderation, and the full source code can be found at the project site on Github.
At the time of release the project contains a number of web controls, additional PageDataCollection filters and a number of extension methods. In future blog posts I will provide examples on how to use the different features of the library.
The project is released as public domain, so feel free to use it for any purpose. Be warned that public and free also implies no warranty, so use it at own risk. Never shortcut your regular functional and security tests when using an open source project.
So what about the bread crumbs menu? Well, after you add the EPiUtilities nuget package to your project all you need is to put something like this in your aspx or ascx file:
<EPiUtil:BreadCrumbsMenu AutoBind="true" runat="server"> <HeaderTemplate> <ul class="breadcrumbs"> </HeaderTemplate> <ItemTemplate> <li> <%# Container.Item.ToHtmlAnchorWithLinkUrlAndPageName() %></li> </ItemTemplate> <SelectedItemTemplate> <li> <%# Container.Item.PageName %></li></SelectedItemTemplate> <SeparatorTemplate> <li>></li></SeparatorTemplate> <FooterTemplate> </ul></FooterTemplate> </EPiUtil:BreadCrumbsMenu>