Cache templates by type.

We have a `.modal.php`, `.iframe.php` and `.html.php` once one is cached, it brings up that same file again. This solves that.