Update template.php

Fetch includes and meta changes from the app and controller, both. Need to merge them later into one, for cleaner templates.