Fixing homepage changes
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
<?
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
/*
|
||||
* WARNING: DO NOT EDIT THIS FILE.
|
||||
@ -6,6 +8,8 @@
|
||||
* Daux.io without overwritting your changes. Instead use the config.json file
|
||||
* in the /docs folder to customize your documentation.
|
||||
*
|
||||
* Want to add a new feature? Send me a pull request or open an issue - https://github.com/justinwalsh/daux.io
|
||||
*
|
||||
* Learn more about what you can customize here: http://daux.io
|
||||
*/
|
||||
|
||||
@ -19,13 +23,12 @@ if ($path === '/' || $path === '') {
|
||||
$homepage = false;
|
||||
}
|
||||
|
||||
// TM-Docs Functions
|
||||
// Daux.io Functions
|
||||
function get_options() {
|
||||
$options = array(
|
||||
'title' => "Documentation",
|
||||
'tagline' => false,
|
||||
'image' => false,
|
||||
'homepage' => false,
|
||||
'theme' => 'blue',
|
||||
'float' => true,
|
||||
'repo' => false,
|
||||
@ -54,16 +57,38 @@ function get_options() {
|
||||
}
|
||||
}
|
||||
|
||||
// Homepage Redirect?
|
||||
$path = url_path();
|
||||
if ($path === '/') {
|
||||
// Custom Homepage?
|
||||
if ($options['homepage']) {
|
||||
header('Location: '.$options['homepage']);
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
|
||||
function homepage_url($tree) {
|
||||
// Check for homepage
|
||||
if (isset($tree['index'])) {
|
||||
return '/';
|
||||
} else {
|
||||
return docs_url($tree);
|
||||
}
|
||||
}
|
||||
|
||||
function docs_url($tree, $branch = false) {
|
||||
// Get next branch
|
||||
if (!$branch) {
|
||||
$branch = current($tree);
|
||||
}
|
||||
|
||||
return $options;
|
||||
if ($branch['type'] === 'file') {
|
||||
return $branch['url'];
|
||||
} else if (!empty($branch['tree'])) {
|
||||
return docs_url($branch['tree']);
|
||||
} else {
|
||||
// Try next folder...
|
||||
$branch = next($tree);
|
||||
if ($branch) {
|
||||
return docs_url($tree, $branch);
|
||||
} else {
|
||||
echo '<strong>Daux.io Config Error:</strong><br>Unable to find the first page in the /docs folder. Double check you have at least one file in the root of of the /docs folder. Also make sure you do not have any empty folders. Visit the docs to <a href="http://daux.io">learn more</a> about how the default routing works.';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function load_page($tree) {
|
||||
@ -135,6 +160,9 @@ function clean_name($text) {
|
||||
}
|
||||
|
||||
function build_nav($tree, $url_params = false) {
|
||||
// Remove Index
|
||||
unset($tree['index']);
|
||||
|
||||
if (!is_array($url_params)) {
|
||||
$url_params = url_params();
|
||||
}
|
||||
|
Reference in New Issue
Block a user