mirror of
https://github.com/klokantech/tileserver-php.git
synced 2025-08-07 23:26:32 +02:00
Custom template implementation #31
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
global $config;
|
||||
$config['serverTitle'] = 'TileServer-php v1';
|
||||
$config['availableFormats'] = array('png', 'jpg', 'jpeg', 'gif', 'webp', 'pbf', 'hybrid');
|
||||
//$config['template'] = 'template.php';
|
||||
//$config['baseUrls'] = array('t0.server.com', 't1.server.com');
|
||||
|
||||
Router::serve(array(
|
||||
@@ -74,6 +75,10 @@ class Server {
|
||||
$this->config['baseUrls'] = is_array($envBaseUrls) ?
|
||||
$envBaseUrls : explode(',', $envBaseUrls);
|
||||
}
|
||||
$envTemplate = getenv('template');
|
||||
if($envBaseUrls !== FALSE){
|
||||
$this->config['template'] = $envTemplate;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -516,6 +521,11 @@ class Server {
|
||||
public function getHtml() {
|
||||
$this->setDatasets();
|
||||
$maps = array_merge($this->fileLayer, $this->dbLayer);
|
||||
if (isset($this->config['template']) && file_exists($this->config['template'])) {
|
||||
$baseUrls = $this->config['baseUrls'];
|
||||
$serverTitle = $this->config['serverTitle'];
|
||||
include_once $this->config['template'];
|
||||
} else {
|
||||
header('Content-Type: text/html;charset=UTF-8');
|
||||
echo '<!DOCTYPE html><html><head><meta charset="UTF-8"><title>' . $this->config['serverTitle'] . '</title>';
|
||||
echo '<link rel="stylesheet" type="text/css" href="//cdn.klokantech.com/tileviewer/v1/index.css" />
|
||||
@@ -539,6 +549,7 @@ class Server {
|
||||
}
|
||||
echo '</body></html>';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user