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:
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user