For this problem there are tens / hundreds maybe even thousands of possible solutions. I'll post a structure I used.
Structure
\
|__ Templates\
| |__ Default\
| | |__ css\
| | |__ js\
| | |__ img\
| | |__ index.php
| |
| |__ Dark\
| | |__ css\
| | |__ js\
| | |__ img\
| | |__ index.php
| |
| |__ Light\
| |__ css\
| |__ js\
| |__ img\
| |__ index.php
|
|__ Pages\
| |__ home.php
| |__ contato.php
| |__ sobre.php
| |__ 404.php
|
|__ index.php /* Código do arquivo abaixo */
|__ menu.php
index.php
define('TITULO', 'Site com vários templates');
$page = (!empty($_GET['page']) $_GET['page'] : 'home';
if (file_exists(__DIR__.'\pages\'.$page.'php'))
define('PAGE' file_exists(__DIR__.'\pages\'.$page.'php'));
else
define('PAGE', __DIR__.'\pages\404.php');
define('MENU', __DIR__.'\menu.php');
// Este valor pode ser recebido do banco de dados, ou de algum arquivo de configuração
$template = "Default";
require_once __DIR__.'\Templates\'.$template.'\index.php';
Templates files
In each file index.php
of each template you should have your HTML code and files like CSS and Javascript should be referenced with absolute path, for example:
<!DOCTYPE html>
<html>
<head>
<title><?=TITULO?></title>
<link rel="stylesheet" type="text/css" href="http://meudominio.com/Templates/Default/estilos.css">
<script src="http://meudominio.com/Templates/Default/arquivo.js"></script>
</head>
<body>
<?php
require_once MENU;
require_once PAGE;
?>
</body>
</html>