Off the shelf applications don't always do what you want them to do, so usually, a little customization is in order. For some applications, it is like wading through the bayou as you look through their code to find the right spot to make your change. Other projects have their stuff in order and you're surprised at how easy it is to modify and extend what they've packaged up for you. ImpressCMS is definitely falling into the second category!
After using hashtags and mentions on Twitter and Facebook, I thought 'This would be a cool little addition to ImpressCMS!' So, I started out to create plugins to allow me to use these common tags.
Extending the ImpressCMS Textsanitizer
It's fair to say I've spent more than a little time in the code of ImpressCMS, but with a little research and some help in the forums, just about anyone who can understand just a little PHP and with the right tools can create a plugin (or even a module) for ImpressCMS.
What tools do you need?
A text editor. And, if you're not a regular expressions wizard, an regex tool, like the Regular Expressions Tester extension for Firefox. If you want to test this locally, you'll need to set up a web server, like XAMPP, to run and install your site.
Where do you go next?
If you look through the administration area of ImpressCMS, you'll find a Plugins Manager under Preferences. On closer examination, you'll see several plugins already listed - hiddencontent, syntaxhighlightercss, syntaxhighlighterjs, syntaxhighlighterhtml and several others - now you just need to find the code for those plugins. A quick file search will lead you to /your-root-path/plugins/textsanitizer/ - every plugin listed as a corresponding folder here. So, it makes sense our new plugin will go here, too. Using these files as a pattern for our new plugin, it was very easy to create a plugin for using hashtags in posts.
The following video will take you through the complete process, step by step. I also talk about some of the coding standards we use and 'Convention Over Configuration' - a practice that makes programming easier for everyone. The video is 25 minutes long and rather than chop it up so it all fit on YouTube, I left it complete and uploaded it to blip.tv - you can watch it there. Creating a textsanitizer plugin for ImpressCMS
Along the way, it's always good to share some other information about the code behind ImpressCMS. Here are a few resources that give you a look into our standards and practices, with a few optimization tweaks thrown in.
Make It Go Faster series -
- http://community.impresscms.org/mod ... ost_id=146
- http://community.impresscms.org/mod ... ost_id=147
- http://community.impresscms.org/mod ... ost_id=148
- http://community.impresscms.org/mod ... ost_id=159
- http://community.impresscms.org/mod ... ost_id=162
Once you see how easy it is to customize ImpressCMS without having to hack a bunch of files that will be overwritten with your next upgrade, you'll find all sorts of things to add - you'll be hooked!