Graffiti Plug-ins Thursday, November 15 2007
Yesterday I put the finishing touches on what is the first plug-in for Graffiti. I had originally written a 301 Permanent redirect module as a HttpModule to redirect traffic from Community Server to Graffiti (read more about it here). I was then told "you could have done that using plug-ins you know?". My first reaction to that was "Ok, so what are plug-ins?" and in this post, I hope to answer that question.
If you're familiar with CSModules in Community Server, they are very similar, but much more powerful and yet still just as easy to write. Graffiti plug-ins are basically pieces of code that can run when certain events happen. For my plug-in I wanted to run my code when the request started so I could analyze the URL and redirect the page if necessary. Doing that was as easy as inheriting from the GraffitiEvent class and adding a line to create a hook to my method and then my code would run (there will be more posts in the future where I will dive into coding a plug-in and a widget).
The two things that really distinguish Graffiti Plug-ins from CSModules though, is the ability to easily define properties and give the user a way to set these in the Graffiti Control Panel, and the fact there are no configuration files to change to register your plug-in. Deployment is as simple as dropping the .dll into the /bin folder and enabling the plug-in in the Control Panel. That's it!
There are many more posts coming on the extensibility of Graffiti. It's an area I am very excited about and have lots of ideas for. I've already written a couple of widgets and now a plug-in along with four themes and all the time I'm amazed at how simple things are, whilst having so much power!







