Umbraco Training Day 4
Today was my last day of my Umbraco Training! I have fought with the Umbraco monster and have slayin it. The last day of battles was against Examine, Events, the Umbraco Dashboard, and editing Properties.
Examine
Examine is a search tool which is extremely fast and highly customizable. It includes Fluent search and indexes content, media and members. If you are using XSLTSearch and you find that it is starting to slow down because you have too much content, or you are implementing a new search and expect a lot of content Examine is a wonderful solution.
The indexes of Examine create a search that is lightning fast. It takes a bit more to setup than XSLTSearch, but once you get it working your search will be the fastest search on your webpage!
This is an image from the ExamineSettings.config file. It contains an indexer to ensure that Umbraco automatically gets indexed, and a searcher which allows us to search a specific index with a specific index analyzer.
We changed the supportProtected because our intranet is protected. Without this it won't search protected indexes. Also with SupportUmpublished if set to true you will search your unpublished content.
The out of the box configuration files should let you perform searches. If you want a more indepth walkthrough of the Examine configuration visit the Examine documentation
To set it up you need to create a Razor macro and pass it a parameter somehow. We passed it through the URL query string parameters.
This will search the library for the term which was retrieved from the URL and then show the item retrieved as well as the date which will link to the item.
You can also search Members using Examine. To do this it is much like the content search works.
The difference here is we grab a list of our members and then search through that using our parameter.
Events
The events in Umbraco are Native .NET Events! So if you understand .NET Events then you understand Umbraco events.
One of the things you need to do to get your events working is to have your EventHandler class inherit from ApplicationStartupHandler.
The second thing you need to do is add wireup your Event Handler inside your constructor. Then you tell your event what to do upon receiving an event.
One thing to remember about events is that every object which you wire it to will throw that event. If you wire it to a document but only want one specific document then you need to make sure that the document firing the event has the correct alias.
Dashboard
Have you ever wondered how the tabs get onto the dashboard items such as Content? Well there is a Dashboard.config file where you can specify which items you want.
<area> specifies which dashboard you want to change, <tab> will be the tabs that you want to change. to add a new tab just copy and rename a <tab caption="Tab Name"> tab.
Then you can take it even further, you can add your own UserControl to the dashboard! You can display a list of recent comments on your blog and give yourself a way to remove any comments you don't approve of if you want.
It is even possible to pass parameters from your dashboard to your UserControl! The magical way in which you do this is on your code behind, declare your properties that you want as macros,
and then add them into the tab
Data Editors
Data Editor are used to enter content into umbraco. Examples of default Data Editors are Textboxes, multiline textboxes, date pickers, drop down lists, and google maps. Data editors are not the same as Data Types. Data editors is your control, a data type is a data editor plus settings. A drop down list is a data editor, while a drop down list populated with companies is a datatype.
The way to implement a Data Editor is by creating a UserControl and implementing IUserControlDataEditor. Each Data Editor can only have 1 property.
This data editor will only be a blank text box, but with a bit of java script you can turn it into a member picker which will pull from a list of members registered for your site!
So my adventure with Umbraco CertificationTraining has ended. It was a long four days, but has ended successfully. I have achieved both Level 1 and 2 certification and am proud to say that I am an Umbraco Certified Developer.
Nothing I have written in any of these blogs compares to the real experience of the training however. I would recommend going and taking the training yourself. The experience of actually running through all these exercises is priceless. I feel like I could tackle any challenges with Umbraco! What a wonderful CMS!