From 0e8547c78448060f692646757b7495e039f39b51 Mon Sep 17 00:00:00 2001 From: Gautham Warrier Date: Sat, 20 Sep 2014 01:53:30 +0530 Subject: [PATCH] Revert to old Clean_Urls flag in config.json --- default.json | 1 + docs/00_Getting_Started.md | 10 ++++++++++ docs/config.json | 1 + libs/daux.php | 4 ++-- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/default.json b/default.json index af1d76a..ae7c8c8 100755 --- a/default.json +++ b/default.json @@ -6,6 +6,7 @@ "theme": "daux-blue", "breadcrumbs": false, "template": "default", + "clean_urls": false, "toggle_code": false, "date_modified": false, "float": false, diff --git a/docs/00_Getting_Started.md b/docs/00_Getting_Started.md index bfeeed4..0ce6b70 100644 --- a/docs/00_Getting_Started.md +++ b/docs/00_Getting_Started.md @@ -84,6 +84,16 @@ Note: The image can be a local or remote image. Use the convention `` If you are interested in having a landing page for a subsection of your docs, all you need to do is add an `index.md` file to the folder. For example, `/docs/01_Examples` has a landing page for that section since there exists a `/docs/01_Examples/index.md` file. If you wish to have an landing page for a section sans the document format, use the name `_index.md` +## Clean URLs + +Daux provides native support for Clean URLs provided the webserver has its URL Rewrite module enabled. To enable the same, simply set the toggle in the `config.json` file in the `/docs` folder. + +```json +{ + "clean_urls": true +} +``` + ## Configuration To customize the look and feel of your documentation, you can create a `config.json` file in the of the `/docs` folder. The `config.json` file is a simple JSON object that you can use to change some of the basic settings of the documentation. diff --git a/docs/config.json b/docs/config.json index 95914e7..47bbdbf 100644 --- a/docs/config.json +++ b/docs/config.json @@ -5,6 +5,7 @@ "image": "img/app.png", "theme": "daux-blue", "template": "default", + "clean_urls": true, "toggle_code": true, "breadcrumbs": true, "breadcrumb_separator": "Chevrons", diff --git a/libs/daux.php b/libs/daux.php index 8d3cc48..a1952a1 100644 --- a/libs/daux.php +++ b/libs/daux.php @@ -42,8 +42,6 @@ public function handle_request($url, $query = array()) { if ($this->error) return $this->error_page; - $t = substr($url, strlen($this->base_url) + 1); - $this->params['clean_urls'] = !(strpos($t, 'index.php') === 0); if (!$this->params['clean_urls']) $this->params['base_page'] .= 'index.php?request='; $request = DauxHelper::get_request_from_url($url, $this->base_url); $request = urldecode($request); @@ -207,6 +205,7 @@ $params['host'] = $this->host; $params['tree'] = $this->tree; $params['index'] = ($this->tree->index_page !== false) ? $this->tree->index_page : $this->tree->first_page; + $params['clean_urls'] = $this->options['clean_urls']; $params['tagline'] = $this->options['tagline']; $params['title'] = $this->options['title']; @@ -236,6 +235,7 @@ $params['host'] = $this->host; $params['tree'] = $this->tree; $params['index'] = ($this->tree->index_page !== false) ? $this->tree->index_page : $this->tree->first_page; + $params['clean_urls'] = $this->options['clean_urls']; $params['tagline'] = $this->options['tagline']; $params['title'] = $this->options['title'];