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
parent 9ef2f5aee4
commit 7981f523a4
2 changed files with 13 additions and 3 deletions

View File

@ -76,6 +76,8 @@
$this->host = $_SERVER['HTTP_HOST']; $this->host = $_SERVER['HTTP_HOST'];
$this->base_url = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']; $this->base_url = $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
$this->base_url = substr($this->base_url, 0, strrpos($this->base_url, '/')); $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) { private function load_global_config($global_config_file) {
@ -139,7 +141,9 @@
private function recursive_generate_static($tree, $output_dir, $params, $base_url = '') { private function recursive_generate_static($tree, $output_dir, $params, $base_url = '') {
$params['base_url'] = $params['base_page'] = $base_url; $params['base_url'] = $params['base_page'] = $base_url;
$new_params = $params; $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']); $params['image'] = str_replace('<base_url>', $base_url, $params['image']);
if ($base_url !== '') $params['entry_page'] = $tree->first_page; if ($base_url !== '') $params['entry_page'] = $tree->first_page;
foreach ($tree->value as $key => $node) { foreach ($tree->value as $key => $node) {

View File

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