1
0
mirror of https://github.com/restoreddev/phpapprentice.git synced 2025-08-13 02:04:26 +02:00

Wrote two chapters for web section

Also, tweaked build to allow for nested folders
This commit is contained in:
Andrew Davis
2019-02-17 21:29:29 -06:00
parent 9fbb1ab290
commit e17a687d99
9 changed files with 143 additions and 3 deletions

View File

@@ -115,7 +115,14 @@ class Build
}
$output = $this->getOutput($template, $page->variables);
file_put_contents(config('output_dir') . '/' . $page->name . '.html', $output);
$path = config('output_dir') . '/' . $page->name . '.html';
$dir = pathinfo($path, PATHINFO_DIRNAME);
if (!file_exists($dir)) {
mkdir($dir, 0777, true);
}
file_put_contents($path, $output);
return $output;
}

View File

@@ -16,8 +16,13 @@ if ($pathinfo['dirname'] == '/' && !isset($pathinfo['extension'])) {
}
if ($pathinfo['extension'] == 'html') {
$name = $pathinfo['filename'];
if ($pathinfo['dirname'] != '/') {
$name = ltrim($pathinfo['dirname'], '/') . '/' . $name;
}
$build = new Apprentice\Build;
$output = $build->runSingleBuild($pathinfo['filename']);
$output = $build->runSingleBuild($name);
echo $output;