diff --git a/attributealter/feideaccess.php b/attributealter/feideaccess.php
index e939c43031a5211007e3e265352ec586cd9a5c17..d2972752d33979997c6fdbf27a47e739a77d8f32 100644
--- a/attributealter/feideaccess.php
+++ b/attributealter/feideaccess.php
@@ -23,7 +23,7 @@ function attributealter_feideaccess(&$attributes, $spEntityId = null, $idpEntity
 		SimpleSAML_Logger::error('FEIDE access control: Organization "' . $org .
 			'" not in list of allowed organization for SP "' . $spEntityId . '".');
 		$config = SimpleSAML_Configuration::getInstance();
-		$t = new SimpleSAML_XHTML_Template($config, 'no_access.php', 'no_access_dictionary.php');
+		$t = new SimpleSAML_XHTML_Template($config, 'no_access.php', 'no_access_dictionary');
 		if(array_key_exists('name', $spMetadata)) {
 			$t->data['sp_name'] = $spMetadata['name'];
 		} else {
diff --git a/lib/SimpleSAML/Utilities.php b/lib/SimpleSAML/Utilities.php
index 54ed4c201312443fdc48a452136a63e5ab2671bf..0d2298afe78e932e58d9e9a3dd0ed0675ddedf03 100644
--- a/lib/SimpleSAML/Utilities.php
+++ b/lib/SimpleSAML/Utilities.php
@@ -400,7 +400,7 @@ class SimpleSAML_Utilities {
 		SimpleSAML_Logger::error($_SERVER['PHP_SELF'].' - UserError: ErrCode:'.(!empty($errorcode) ? $errorcode : 'na').': '.urlencode($emsg) );
 		
 		$languagefile = null;
-		if (isset($errorcode)) $languagefile = 'errors.php';
+		if (isset($errorcode)) $languagefile = 'errors';
 		
 		// Initialize a template
 		$t = new SimpleSAML_XHTML_Template($config, 'error.php', $languagefile);
diff --git a/lib/SimpleSAML/XHTML/IdPDisco.php b/lib/SimpleSAML/XHTML/IdPDisco.php
index 57c968e844da90460d84bb662d8fddc891e43d40..2b7c07c1ceb797fd3f4727611c9f6dceb3cb5aa3 100644
--- a/lib/SimpleSAML/XHTML/IdPDisco.php
+++ b/lib/SimpleSAML/XHTML/IdPDisco.php
@@ -371,7 +371,7 @@ class SimpleSAML_XHTML_IdPDisco {
 			throw new Exception('Invalid value for the \'idpdisco.layout\' option.');
 		}
 
-		$t = new SimpleSAML_XHTML_Template($this->config, $templateFile, 'disco.php');
+		$t = new SimpleSAML_XHTML_Template($this->config, $templateFile, 'disco');
 		$t->data['idplist'] = $idpList;
 		$t->data['preferredidp'] = $preferredIdP;
 		$t->data['return'] = $this->returnURL;
diff --git a/www/admin/config.php b/www/admin/config.php
index e9363c97ed2d4aae5811a8d8a42f1e79d5cc94b6..6242d77daae4877a63ce3c80dc1f7cb2ef7c6b59 100644
--- a/www/admin/config.php
+++ b/www/admin/config.php
@@ -196,7 +196,7 @@ if(array_key_exists('file', $_GET)) {
 
 
 /* Initialize template page. */
-$et = new SimpleSAML_XHTML_Template($config, 'admin-config.php', 'admin.php');
+$et = new SimpleSAML_XHTML_Template($config, 'admin-config.php', 'admin');
 $et->data['url'] = SimpleSAML_Utilities::selfURLNoQuery();
 
 if($file === NULL) {
diff --git a/www/admin/metadata-converter.php b/www/admin/metadata-converter.php
index 1e356c43cabe8b3ad4e8ec60ae0542b171a09408..68d42130adb2b2241cc6f5860292322d3c484f52 100644
--- a/www/admin/metadata-converter.php
+++ b/www/admin/metadata-converter.php
@@ -52,7 +52,7 @@ try {
 	}
 
 
-	$template = new SimpleSAML_XHTML_Template($config, 'metadata-converter.php', 'admin.php');
+	$template = new SimpleSAML_XHTML_Template($config, 'metadata-converter.php', 'admin');
 
 	$template->data['xmldata'] = $xmldata;
 	$template->data['output'] = $output;
diff --git a/www/admin/metadata.php b/www/admin/metadata.php
index 25df008b708d42c027f2c8421f72c3aee9009203..b5540843023a6a15b57d71466584b4bec11b555c 100644
--- a/www/admin/metadata.php
+++ b/www/admin/metadata.php
@@ -19,7 +19,7 @@ try {
 
 	$metadata = SimpleSAML_Metadata_MetaDataStorageHandler::getMetadataHandler();
 
-	$et = new SimpleSAML_XHTML_Template($config, 'admin-metadatalist.php', 'admin.php');
+	$et = new SimpleSAML_XHTML_Template($config, 'admin-metadatalist.php', 'admin');
 
 
 	if ($config->getValue('enable.saml20-sp') === true) {
diff --git a/www/auth/login-admin.php b/www/auth/login-admin.php
index ede6fb358231019a00d8142c145f575284267480..307140809d7deb2abfe1cb59f20d17e6acf35c6c 100644
--- a/www/auth/login-admin.php
+++ b/www/auth/login-admin.php
@@ -79,7 +79,7 @@ if (isset($_POST['password'])) {
 }
 
 
-$t = new SimpleSAML_XHTML_Template($config, 'login.php', 'login.php');
+$t = new SimpleSAML_XHTML_Template($config, 'login.php', 'login');
 
 $t->data['header'] = 'simpleSAMLphp: Enter username and password';	
 $t->data['relaystate'] = $relaystate;
diff --git a/www/auth/login-auto.php b/www/auth/login-auto.php
index 771dfa7186a5bf4bd3f210fc237925b3e6f1a50f..859597e9c92419597ea6d4441ed5b5d6ba474775 100644
--- a/www/auth/login-auto.php
+++ b/www/auth/login-auto.php
@@ -44,7 +44,7 @@ if(!is_array($attributes)) {
 if($ask_login && !array_key_exists('username', $_POST)) {
 	/* Show login page. */
 
-	$t = new SimpleSAML_XHTML_Template($config, 'login.php', 'login.php');
+	$t = new SimpleSAML_XHTML_Template($config, 'login.php', 'login');
 
 	$t->data['header'] = 'simpleSAMLphp: Enter username and password';
 	$t->data['relaystate'] = $_REQUEST['RelayState'];
diff --git a/www/auth/login-feide.php b/www/auth/login-feide.php
index b0a11ec4477be94d06c54efbe6ee1bec204f3e32..efec4e21abd34b2f6f8e75cec91abefa47054255 100644
--- a/www/auth/login-feide.php
+++ b/www/auth/login-feide.php
@@ -268,7 +268,7 @@ if (isset($_REQUEST['username'])) {
 }
 
 
-$t = new SimpleSAML_XHTML_Template($config, 'login-feide.php', 'login.php');
+$t = new SimpleSAML_XHTML_Template($config, 'login-feide.php', 'login');
 
 $t->data['header'] = 'simpleSAMLphp: Enter username and password';	
 $t->data['relaystate'] = $_REQUEST['RelayState'];
diff --git a/www/auth/login-ldapmulti.php b/www/auth/login-ldapmulti.php
index 2700071281a52a9d902a1a72ac75408a534d1757..a2052670dd11914267717599a50d095385f40b30 100644
--- a/www/auth/login-ldapmulti.php
+++ b/www/auth/login-ldapmulti.php
@@ -117,7 +117,7 @@ if (isset($_POST['username'])) {
 }
 
 
-$t = new SimpleSAML_XHTML_Template($config, 'login-ldapmulti.php', 'login.php');
+$t = new SimpleSAML_XHTML_Template($config, 'login-ldapmulti.php', 'login');
 
 $t->data['header'] = 'simpleSAMLphp: Enter username and password';	
 $t->data['relaystate'] = $_REQUEST['RelayState'];
diff --git a/www/auth/login-radius.php b/www/auth/login-radius.php
index fd90e86cd23413d43d875ab3d1378d60e49bfa18..2047a0e79d39ccdb61b8b86aa26dae6d026d603d 100644
--- a/www/auth/login-radius.php
+++ b/www/auth/login-radius.php
@@ -131,7 +131,7 @@ if (isset($_POST['username'])) {
 }
 
 
-$t = new SimpleSAML_XHTML_Template($config, 'login.php', 'login.php');
+$t = new SimpleSAML_XHTML_Template($config, 'login.php', 'login');
 
 $t->data['header'] = 'simpleSAMLphp: Enter username and password';	
 $t->data['relaystate'] = $_REQUEST['RelayState'];
diff --git a/www/auth/login.php b/www/auth/login.php
index 89d0592971f5723f1bee90529fb5d6caef12490d..df69a8787f388f328947fafb366b412faa7c2da1 100644
--- a/www/auth/login.php
+++ b/www/auth/login.php
@@ -139,7 +139,7 @@ if (isset($_POST['username'])) {
 }
 
 
-$t = new SimpleSAML_XHTML_Template($config, 'login.php', 'login.php');
+$t = new SimpleSAML_XHTML_Template($config, 'login.php', 'login');
 
 $t->data['header'] = 'simpleSAMLphp: Enter username and password';
 $t->data['relaystate'] = $relaystate;
diff --git a/www/errorreport.php b/www/errorreport.php
index fe54bfaa510154eb7c47572ef8ea2e2ccc1fa163..2a98dcf88730c5a5f3f30104f1a544ec4672c1b3 100644
--- a/www/errorreport.php
+++ b/www/errorreport.php
@@ -8,7 +8,7 @@ $config = SimpleSAML_Configuration::getInstance();
 if($_SERVER['REQUEST_METHOD'] !== 'POST') {
 	/* The message has been sent. Show error report page. */
 
-	$t = new SimpleSAML_XHTML_Template($config, 'errorreport.php', 'errors.php');
+	$t = new SimpleSAML_XHTML_Template($config, 'errorreport.php', 'errors');
 	$t->show();
 	exit;
 }
diff --git a/www/example-simple/saml2-example.php b/www/example-simple/saml2-example.php
index 2997032b6990dcf37fd74ecd77db9cedcb777467..426be7b1fc263e814097eaff18d49725dcd05854 100644
--- a/www/example-simple/saml2-example.php
+++ b/www/example-simple/saml2-example.php
@@ -48,7 +48,7 @@ $attributes = $session->getAttributes();
  *
  */
 
-$t = new SimpleSAML_XHTML_Template($config, 'status.php', 'attributes.php');
+$t = new SimpleSAML_XHTML_Template($config, 'status.php', 'attributes');
 
 $t->data['header'] = 'SAML 2.0 SP Demo Example';
 $t->data['remaining'] = $session->remainingTime();
diff --git a/www/example-simple/wsfed-example.php b/www/example-simple/wsfed-example.php
index 8c01bb12458f796de188dfe4d1ff39cd2a290dc6..0908962ef5ab853334700bc8d3ccb534348e86ae 100644
--- a/www/example-simple/wsfed-example.php
+++ b/www/example-simple/wsfed-example.php
@@ -14,7 +14,7 @@ if (!$session->isValid('wsfed') ) {
 
 $attributes = $session->getAttributes();
 
-$t = new SimpleSAML_XHTML_Template($config, 'status.php', 'attributes.php');
+$t = new SimpleSAML_XHTML_Template($config, 'status.php', 'attributes');
 
 $t->data['header'] = 'WS-Fed SP Demo Example';
 $t->data['remaining'] = $session->remainingTime();
diff --git a/www/index.php b/www/index.php
index ace4668dfc49361451ed71013dede03e66279311..5a63030c8f92a7905a7ea74f05b97b1cfe791f00 100644
--- a/www/index.php
+++ b/www/index.php
@@ -214,7 +214,7 @@ $funcmatrix[] = array(
 
 
 
-$t = new SimpleSAML_XHTML_Template($config, 'frontpage.php', 'frontpage.php');
+$t = new SimpleSAML_XHTML_Template($config, 'frontpage.php', 'frontpage');
 $t->data['header'] = 'simpleSAMLphp installation page';
 $t->data['icon'] = 'compass_l.png';
 $t->data['warnings'] = $warnings;
diff --git a/www/metashare/add.php b/www/metashare/add.php
index dd658db723dfc32b792683f6fe4d2f8250315a09..138d07b5b1b7bfb923cc3e623a5bb21d184b5222 100644
--- a/www/metashare/add.php
+++ b/www/metashare/add.php
@@ -16,7 +16,7 @@ if(!$metaConfig->getBoolean('metashare.enable', FALSE)) {
 }
 
 $store = SimpleSAML_MetaShare_Store::getInstance();
-$t = new SimpleSAML_XHTML_Template($config, 'metashare-add.php', 'metashare.php');
+$t = new SimpleSAML_XHTML_Template($config, 'metashare-add.php', 'metashare');
 
 
 if(!array_key_exists('url', $_GET) || empty($_GET['url'])) {
diff --git a/www/metashare/index.php b/www/metashare/index.php
index 1f52caebd392991b932b4310252396c90fc33bb1..920ecc873858c4a031fa6e311e27c7f969a5f72c 100644
--- a/www/metashare/index.php
+++ b/www/metashare/index.php
@@ -18,7 +18,7 @@ if(!$metaConfig->getBoolean('metashare.enable', FALSE)) {
 $store = SimpleSAML_MetaShare_Store::getInstance();
 $entities = $store->getEntityList();
 
-$t = new SimpleSAML_XHTML_Template($config, 'metashare-list.php', 'metashare.php');
+$t = new SimpleSAML_XHTML_Template($config, 'metashare-list.php', 'metashare');
 $t->data['entities'] = $entities;
 $t->show();
 exit;
diff --git a/www/saml2/idp/SSOService.php b/www/saml2/idp/SSOService.php
index c96c3531711df4a222bc0e4cc8beb506e047a431..1c0ab74600d5ed47779e95f99e8cf1834d8f6caf 100644
--- a/www/saml2/idp/SSOService.php
+++ b/www/saml2/idp/SSOService.php
@@ -272,7 +272,7 @@ if($needAuth && !$isPassive) {
 				$authId = SimpleSAML_Utilities::generateID();
 				$session->setAuthnRequest('saml2', $authId, $requestcache);
 				
-				$t = new SimpleSAML_XHTML_Template($config, 'consent.php', 'attributes.php');
+				$t = new SimpleSAML_XHTML_Template($config, 'consent.php', 'attributes');
 				$t->data['header'] = 'Consent';
 				$t->data['sp_name'] = $sp_name;
 				$t->data['idp_name'] = (isset($idpmetadata['name']) ? $idpmetadata['name'] : $idpentityid);
diff --git a/www/saml2/idp/metadata.php b/www/saml2/idp/metadata.php
index c890b9de19c98dbf66927a23f3e88989ad10ab9b..82ed4d188afa5aaafa094e28b0ce3261e2779990 100644
--- a/www/saml2/idp/metadata.php
+++ b/www/saml2/idp/metadata.php
@@ -87,7 +87,7 @@ try {
 	if (array_key_exists('output', $_GET) && $_GET['output'] == 'xhtml') {
 		$defaultidp = $config->getValue('default-saml20-idp');
 		
-		$t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin.php');
+		$t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin');
 		
 	
 		$t->data['header'] = 'saml20-idp';
diff --git a/www/saml2/sp/metadata.php b/www/saml2/sp/metadata.php
index e31e3a1a51eeecfb16b61c3e03b9307ebfb3430b..9499fd5897bfa56dba5d502e4039ff897eb62e30 100644
--- a/www/saml2/sp/metadata.php
+++ b/www/saml2/sp/metadata.php
@@ -84,7 +84,7 @@ try {
 	if (array_key_exists('output', $_GET) && $_GET['output'] == 'xhtml') {
 		$defaultidp = $config->getValue('default-saml20-idp');
 		
-		$t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin.php');
+		$t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin');
 	
 		$t->data['header'] = 'saml20-sp';
 		$t->data['metadata'] = htmlentities($metaxml);
diff --git a/www/shib13/idp/SSOService.php b/www/shib13/idp/SSOService.php
index 34baa010eace07d34e6b3f7d4bf000ebf1b159a3..3862d2daa2852e152ad7be852162a55062b2582b 100644
--- a/www/shib13/idp/SSOService.php
+++ b/www/shib13/idp/SSOService.php
@@ -184,7 +184,7 @@ if (!$session->isAuthenticated($authority) ) {
 				$authId = SimpleSAML_Utilities::generateID();
 				$session->setAuthnRequest('shib13', $authId, $requestcache);
 				
-				$t = new SimpleSAML_XHTML_Template($config, 'consent.php', 'attributes.php');
+				$t = new SimpleSAML_XHTML_Template($config, 'consent.php', 'attributes');
 				$t->data['header'] = 'Consent';
 				$t->data['sp_name'] = $sp_name;
 				$t->data['idp_name'] = (isset($idpmetadata['name']) ? $idpmetadata['name'] : $idpentityid);
diff --git a/www/shib13/idp/metadata.php b/www/shib13/idp/metadata.php
index a38285b4dfae1d3876dab5eb93fc928c2cfa4aba..be1cbfb8221b3ea10ec266c74bdc5df9c9002677 100644
--- a/www/shib13/idp/metadata.php
+++ b/www/shib13/idp/metadata.php
@@ -77,7 +77,7 @@ try {
 	if (array_key_exists('output', $_GET) && $_GET['output'] == 'xhtml') {
 		$defaultidp = $config->getValue('default-shib13-idp');
 		
-		$t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin.php');
+		$t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin');
 	
 		$t->data['header'] = 'shib13-idp';
 		
diff --git a/www/shib13/sp/metadata.php b/www/shib13/sp/metadata.php
index f886eb93001d22db0dd65c4fd845fc92006a42cc..138ca32a1fd35ebe072edda4ad83f182407046af 100644
--- a/www/shib13/sp/metadata.php
+++ b/www/shib13/sp/metadata.php
@@ -56,7 +56,7 @@ try {
 	if (array_key_exists('output', $_GET) && $_GET['output'] == 'xhtml') {
 		$defaultidp = $config->getValue('default-shib13-idp');
 		
-		$t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin.php');
+		$t = new SimpleSAML_XHTML_Template($config, 'metadata.php', 'admin');
 		
 	
 		$t->data['header'] = 'shib13-sp';