split template into body, header and footer