Web Garden Limited is now an Umbraco Certified
Professional! Last week I travelled to Copenhagen to attend the
Level 2 Umbraco training course to become an Umbraco Certified
Professional. As promised, here are some of the tips and tricks
that came up over the two days. There was a lot more covered than
I'll touch on here, but these are the bits that I found most useful
- hopefully you might too.
�
Testing�your .NET Controls that use the Umbraco API
within Visual Studio
Previously, I would always use post-build events to copy my dll
and .ascx files into my Umbraco installation, create macros, add
them to�a test�page in my Umbraco�site�and then hit the page to see
if it works or not. I'd attach to the process in Visual Studio to
step through and debug the code. But what if you want to test by
hitting F5 in Visual Studio? To acheive this, you need to:
1. Copy your web.config, data/ and config/ folders, and the
urlrewriting.dll�into your Visual Studio project.
2. Remove the Channels HttpHandler entries from the
web.config.
3.�In your test page code-behind�you need to set the Page ID of
the page you are simulating so that Umbraco knows where you are. So
in your WebForm1.aspx.cs file, you need this:
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
HttpContext.Current.Items["pageID"] = 1055;
}
And that should be it. Hit F5 in Visual Studio and step through
your code to your heart's content.
�
Using the Dictionary Object to store configuration
settings for your site
In the past, I have created a Configuration node in my Umbraco
builds where the user can specify email addresses for the contact
page, etc. Then in the web.config I would store the ID of the
Configuration Node, which I could then use to access the
information in my user controls, like this:
Node n = new Node(int.Parse(ConfigurationManager.AppSettings["ConfigNodeId"]));
Another way of achieving this is to use the Dictionary object to
store these items. In your codebehind you would code something like
this:
Node n = new Node(int.Parse(umbraco.library.GetDictionaryItem("ConfigNodeId")));
A small change, perhaps, but it means that you can update the ID
through the Umbraco UI without having to edit your web.config file
- so you could do it from any web browser. To give the user access
to the Dictionary object, you can move it from the settings section
into the content section, bringing me to my next point:
�
Moving the Dictionary Object from the settings to the
content section
You may not want to give access to the settings section of
Umbraco to your content editors, but you may want them to be able
to update the email address that the contact us messages go to. So
move the Dictionary into the content section by updating the
database table dbo.umbracoAppTree table and change the appAlias of
the Dictionary entry from settings to content.
Disclaimer: I couldn't get this to work! I can move the
Dictionary object to the developer tab, for instance, using this
method, but not to the content tab. Solutions in the comments
please!
�
Using Windows Live Writer to update your
blog
This has been covered already:
Umbraco
using Live Writer book
Umbraco UK
Developer Meeting Summary of the Day
�
Resharper add-in for Visual Studio 2008
Apparently this is a great tool, I am looking forward to trying
it out myself. Opinion on the course is that it saves you loads of
time as a c# developer.
Resharper add-in
for Visual Studio 2008
�
Umbraco Extensions
If you take a look at the umbracoExt
project in Codeplex there are loads of Umbraco extensions with
full source code to play with, for example the Dashboard
Controls. This is a set of some very nice controls that
appear when your content manager logs into Umbraco. Can be
downloaded from the Umbraco repository in the usual way, however,
the package expects your dashboard configuration file to be called
dashboard.xml (it's now called dashboard.config). So you'll need to
rename your dashboard.config file to dashboard.xml before you
start, and rename it back afterwards.
�
Using XSLT Extensions as your data layer
You can create an XSLT
Extension which goes to an external datasource (or wherever)
and returns an xPathNodeIterator object which you can then format
in your xslt template. I haven't tried this one but it would be
very useful for quickly formatting external data in your Umbraco
site.
�
Just a few tips there that I hope you find helpful. I highly
recommend the course as a way of cementing your existing knowledge,
even if you do already know it all! It's also a good way to meet
other Umbraco professionals - I got to hang out with Darren Ferguson again and we had some
very interesting discussions related to Umbraco and freelancing in
general. Well worth the money!
�