Wednesday, August 17, 2011

New macro types in Umbraco v5

Currently in Umbraco v5, there are 3 types of Macros:

  • Xslt
  • Partial View
  • Surface Action

Both the Partial View and Surface Action macro types are brand new to v5, the Xslt macro will remain very similar to how it works in v4.

Here's a quick run overview of the two new types of Macros in v5…

Partial View Macros

A full dedicated blog post has been written on Partial View Macros HERE which includes detailed explanation, code snippets, etc….

Surface Action Macros

First, we need to explain what the term 'Surface' means: The term 'Surface' relates to a new plugin type in v5 called a Surface Controller which is an MVC controller that interacts with the front-end/render layer of Umbraco, and just like any other MVC Controller, it can contain Actions that render views. Surface Action Macros may in fact be one of the most powerful types of macros in v5 because all of the processing can be done directly by a Controller which is capable of interacting with any of the services registered in the IoC container. This basically means that you can pretty much do anything from within a Surface controller action and then render out any type of view you want … you could even go so far as to render out some Xslt since Xslt is just a view rendered with our Xslt View Engine.

Surface Controllers can interact in many ways with the front-end such as via macros and we'll be writing dedicated blog posts for both Surface Controller Plugins and how to create, use and configure Surface Action Macros in the very near future, stay tuned!

Want to be updated on everything Umbraco?

Sign up for the Umbraco newsletter and get the latest news and special offers send directly to your inbox

Are you sure, that's your real e-mail?