• Adding a field to a content type in an Orchard data migration

    In Orchard you can create your own content type by welding together several content parts. Here is an example of how you'd do that in your data migration:

    ContentDefinitionManager.AlterTypeDefinition("MyNewType",

    cfg => cfg

    .WithPart("TitlePart")

    .WithPart("BodyPart")

    .WithPart("CommonPart")

    );

    You can also add fields to a content type, but it's not obvious at first how to do this. You can't add a field to a type directly, you can only add fields to parts. To get round this you can add a secret part to a type with the same name as the type. This part is not …

  • MailChimp Orchard Module and the Integration Fund

    Back in November 2010 MailChimp announced their 'One Million Integration Fund'. They were offering pots of money to people using their API to integrate with their product. It was early days for me and my new client working on Pianola, but we both loved MailChimp and thought it could be something that would help us out.

    I was also working a lot with Orchard CMS and wanted to use it on this project. As part of building up interest in Pianola while it was being developed we created a sales site using Orchard and we wanted to be able to collect interested people’s email addresses so we could let …

  • They Landed in Las Vegas

    Website screenshot

    I'm very pleased to announce that I’ve just launched the 'They Landed in Vegas' website. It’s my entry for the Orchard Module Challenge.

    The task for round one was to create a module for Microsoft's new Orchard CMS and if you got through round one then in round two you had to create a website to show that module off.

    I love maps and I like the idea of creating tools that help people share their local knowledge using maps. So I created the Bing Map List module. The module lets you create lists of places, which you can then click on to get more information. The admin interface is really simple …

  • A sneak preview of my latest Orchard module

    I'm working on a new Orchard module at the moment for the Orchard Module Contest. It's been my evening project for the last week and I've had a really good day working on it today. I've figured out most of the difficult stuff so it's looking like I will (fingers crossed) finish in time for the deadline on 15 March. There are still a lot of things to add and tidy up though.

    The module lets you create content items for places and then add them to a Bing map. Even if it doesn't win, it's something that should help with several project ideas I have. It would be nice to win though.

    When it's …

  • Using Orchard caching to cache data for a length of time

    You can use standard ASP.NET caching in Orchard, but it makes more sense to use Orchard's CacheManager service. It works better with tenants and I think it’s a bit nicer to use than the usual .NET way.

    I needed to add caching to the driver of my weather module. It gets the weather data from the BBC. This information doesn’t change that often and it takes a while to get. So it made a lot of sense to cache it.

    There are several ways to invalidate a cache, but in this case I just want my cached result to last for a certain amount of time.

    To do this you’ll need an instance of ICacheManager and …

  • Theming Orchard

    I’ve just finished redesigning my site and implementing that design as an Orchard Theme. While it’s still fresh in my head I wanted to write down what I’d learnt. The documentation on the Orchard site is pretty good, but I wanted to write down the things that I found most important. I hope you find it useful.

    An Orchard page is made of lots of bits; layout, zones, shapes, items, parts and fields. This can be a bit confusing and I’m still getting my head round it. You can find a more complete description of all of these in the anatomy of a theme in the Orchard documentation.

    The HTML that …

  • Nogginbox reimagined

    Screenshot of new Nogginbox design

    Today I’m very excited to announce my redesigned website. Ever since becoming a freelance web developer my website has been a work in progress; something that I would finish off when I was less busy. I’m sure my old site must have put some clients off and it definitely didn’t reflect me in the way I wanted.

    Well, I’m still busy, but I decided that 2011 would be the year I made my website something I was really proud of. It’s been my evening and weekend project for a little while now, and all the effort has finally paid off.

    On previous redesign attempts I’ve got stuck at the idea stage. I …

  • Microsoft release more things than you can shake a stick at

    There are quite a few tools and products I’ve been eagerly awaiting from Microsoft. I’ve been working with beta versions and anxiously watching mailing lists for news of new features and possible release dates. I knew some of them would probably come out in January, but they went and released them all, and more this Thursday. It’s very exciting, but this simultaneous release is going to make it harder to learn about all of them.

    Orchard 1.0

    I’m most excited about this. I’ve been working with Orchard and writing some modules for it since their first alpha release in March 2010. Orchard is an …

  • Tag layers in Orchard

    A layer in Orchard CMS allows you to control which pages a widget will appear on. When you install Orchard you get some layers already defined, but you can also add new ones based on rules like url “~/”. I wanted to create a layer based on the tags I had used for the pages content, so I needed a rule that looked at tags.

    When I asked in the forum, it turned out there wasn’t a tagged rule, but it would apparently be easy to write my own. Writing a new rule was quite easy, but getting at the tag info wasn’t. However, with an awful lot of help from the Orchard Team I got one working and I’ve …

  • My first Orchard Widget

    Photo of me in the rain

    When I first learnt ASP.NET I wrote a control for my website that told my visitors the weather I was currently experiencing. It was just a simple, fun project to help me learn. Now I’m using Orchard for my site I still want my visitors to know the weather I am experiencing. So this seemed like the ideal project for my first Orchard CMS module.

    I wanted the module to display a widget that could be placed anywhere using Orchard’s new Widget Manager. At this point in time the documentation for making widgets isn’t complete and I’ve hit a few stumbling blocks along the way.

    The first thing to …