Loving PHP Savant
HelpSpot is using a lesser known LGPL template library called PHP Savant for all the portal aspects of the system. So far I’m really liking it. It’s so so so much better than Smarty which is so heavy and complicated. Savant is light, but provides important features right where you need them. I’m planning on writing up a good size article on how I implemented everything down the road when I have some time, but here’s a little taste.
One of my infinite concerns was that having a fully customizable template system was great for integrating HelpSpot into customers websites, but leads to trouble during upgrades because if they’ve modified the default template and overwrite those files, their changes will be lost. There are some more and less painful ways to deal with this, but luckily Smarty has a great system built in.
All the templates are in a folder /helpspot/templates, these are helpspots default set.
To use a custom version of any of them simply copy the file into /custom_templates and customize it away. Savant lets you set the include paths so that it can check the custom folder first then if it doesn’t find the file it goes to the default. Since HelpSpot will always ship with the /custom_templates folder empty there’s no chance of users losing hours of hard work.
Another great aspect of PHP Savant is that it’s all PHP, no trimmed down template markup “for designers”. Anyone who can figure out a Smarty IF statement can figure out a PHP one, at least that’s my thinking and having the PHP right in there makes it much more transparent what’s going on to those editing the templates.