QuickTip: How to overwrite HtmlHelper tags

In some cases you find it desirable to overwrite the tag templates used by the HtmlHelper. For example if you put all your assets onto a CDN and don’t want to put the hostname in front of all paths (messy..).

With this small modification in the AppHelper class you can do that in bootstrap using Configure, which also allows you to make the tags conditional if you want.. In short: flexibility, wee!
// The code:
class AppHelper extends Helper {
function __construct() {
if ($this->toString() == 'HtmlHelper') {
$tags = Configure::read('HtmlHelper.tags');
if (is_null($tags)) $tags = array();
$this->tags = am($this->tags, $tags);

With this in place (file goes to app root and is called app_helper.php) you can now configure your tags whereever you like passing an array with sprintf templates, like so:
Configure::write('HtmlHelper.tags', array(
'image' => '',

Note: is_null checks if Configure value is set. This way you are not forced to set a empty array to your bootstrap.