Naive fix for serving static files and copying the templates when using the generator.php.

This commit is contained in:
Sofia Ferreira 2014-10-21 19:50:23 +01:00
bovenliggende 9ef2f5aee4
commit 7981f523a4
2 gewijzigde bestanden met toevoegingen van 13 en 3 verwijderingen

Bestand weergeven

@ -76,6 +76,8 @@
$this->host = $_SERVER['HTTP_HOST'];
$this->base_url = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
$this->base_url = substr($this->base_url, 0, strrpos($this->base_url, '/'));
//adding this replace, which replaces the /index.php with nothing seems to resolve the issue with serving static content
$this->base_url = str_replace("/index.php", "", $this->base_url);
}
private function load_global_config($global_config_file) {
@ -139,7 +141,9 @@
private function recursive_generate_static($tree, $output_dir, $params, $base_url = '') {
$params['base_url'] = $params['base_page'] = $base_url;
$new_params = $params;
$params['theme'] = DauxHelper::rebase_theme($params['theme'], $base_url, $params['base_url'] . "themes/" . $params['theme']['name'] . '/');
//changed this as well in order for the templates to be put in the right place
$params['theme'] = DauxHelper::rebase_theme($params['theme'], $base_url, $params['base_url'] . "templates/default/themes/" . $params['theme']['name'] . '/');
//
$params['image'] = str_replace('<base_url>', $base_url, $params['image']);
if ($base_url !== '') $params['entry_page'] = $tree->first_page;
foreach ($tree->value as $key => $node) {

Bestand weergeven

@ -231,8 +231,14 @@ EOT;
static::copy_recursive($local_base . DIRECTORY_SEPARATOR . 'img', $path . DIRECTORY_SEPARATOR . 'img');
@mkdir($path . DIRECTORY_SEPARATOR . 'js');
static::copy_recursive($local_base . DIRECTORY_SEPARATOR . 'js', $path . DIRECTORY_SEPARATOR . 'js');
@mkdir($path . DIRECTORY_SEPARATOR . 'themes');
static::copy_recursive($local_base . DIRECTORY_SEPARATOR . 'themes', $path . DIRECTORY_SEPARATOR . 'themes');
//added and changed these in order to fetch the theme files and put them in the right place
@mkdir($path . DIRECTORY_SEPARATOR . 'templates');
@mkdir($path . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'default');
@mkdir($path . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'default' . DIRECTORY_SEPARATOR . 'themes');
static::copy_recursive($local_base . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR .
'default' . DIRECTORY_SEPARATOR . 'themes', $path . DIRECTORY_SEPARATOR . 'templates' .
DIRECTORY_SEPARATOR . 'default' . DIRECTORY_SEPARATOR . 'themes');
//
}
// Rmdir