Customizing ExpressionEngine 2.x Message Pages
Published: 06/07/2011
Brain Dump, Programming, Code
An unfortunate issue with ExpressionEngine is how internal messaging is handled. It’s really unfortunate that such a nice platform like ExpressionEngine shows such a wart when it comes to managing system pages and templates. Anyone who’s ever had to modify the message pages can tell you; it’s a dirty and counter intuitive deed requiring a lack of best practices that will leave you feeling pretty gross.
The current method of modifying the message pages works as you would expect; this being an ExpressionEngine site you just go to the Design section and you’ll find them under “Message Pages” . There are 3 different types of message pages you can edit (Email Notifications, User Messages and Offline Template) and while it would seem logical on how what to do to get going you’d probably be wrong (if you hadn’t ever tried before). There are a couple problems here…
First, you can’t use EE template tags within those templates. It’s the damnedest thing too because some of those templates (User Messages and Email Notifications) do allow specific tags; they just don’t parse any others. So, if you’re a good little programmer and you build your site using global embeds for building your templates (head & footer for example) you’re hosed. Your only option is to hard code your HTML which, if you’ve built even a simple site, you’ll instantly be filled with remorse and guilt over creating such a maintenance nightmare.
Second, and after the above it’s a minor issue though if you’re good enough for the above to be an issue this’ll probably piss you off too; you can’t save those templates as files. This means version control is going to be a bit of a problem. After nearly 10 years of having version control beat into me this hurt pretty bad. To be honest, because of tight deadline and even tighter budgets I could have lived with the guilt and shame of hard coding just to finish the project but taking away my version control was like adding insult to injury.
It’s quite the head scratcher when you get right down to it; a smart and clever company redesigns their entire product from the ground up and completely drops the ball when it comes to the messaging system. It’s a shame…
There is another option though it does require money; a really nice extension called Custom System Messages. The extension was written by Brian Litzinger and is available for $12 through the ExpressionEngine marketplace Devot:ee.
Custom System Messages works exactly as you would expect ExpressionEngine to work; through a nice interface you choose custom templates for specific messages. You can set a different template for both message scenarios (General Error and Form Submission Error) as well as change the behavior of the {link} template tag so it doesn’t use the lame ass JavaScript “back link”.
The best part though is that Custom System Messages allows you to set special templates based off of all the actions your site has (even those from other modules and extensions). So, for example, if you have a CartThrob site you can set a special template for when adding an item to your cart fails and separate template for when updating an item within a cart fails. It’s really quite slick and for only $12 it’s very reasonable. Priced just enough to dissuade any developer from rolling their own solution.
I do have to say how disappointing it is to see ExpressionEngine lacking this built in. To me, it’s reminiscent of buying a car and being charged extra for the gas cap. Sure, I can just go buy a gas cap for a couple bucks but it really should be a part of the car to begin with.