summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Barnes <eric@ericlbarnes.com>2011-08-21 23:35:07 +0200
committerEric Barnes <eric@ericlbarnes.com>2011-08-21 23:35:07 +0200
commit644ed9000c39289a66d8b52f10d54168f006b717 (patch)
treeadd34415d01955cd350e5ef6c993aeb021954c9b
parent597aff7b9358135ca2566164541267650466b693 (diff)
parent393377fd247f38d57a7324515b57fed5d84b28ff (diff)
Merge pull request #235 from JoeCianflone/develop
Ability to move the view folder out of the Application directory
-rw-r--r--index.php33
-rwxr-xr-xsystem/core/Loader.php2
-rw-r--r--user_guide/installation/index.html4
3 files changed, 37 insertions, 2 deletions
diff --git a/index.php b/index.php
index 899f4ce9b..c50cfed43 100644
--- a/index.php
+++ b/index.php
@@ -73,6 +73,23 @@ if (defined('ENVIRONMENT'))
*
*/
$application_folder = 'application';
+
+/*
+ *---------------------------------------------------------------
+ * VIEW FOLDER NAME
+ *---------------------------------------------------------------
+ *
+ * If you want to move the view folder out of the application
+ * folder set the path to the folder here. The folder can be renamed
+ * and relocated anywhere on your server. If blank, it will default
+ * to the standard location inside your application folder. If you
+ * do move this, use the full server path to this folder
+ *
+ * NO TRAILING SLASH!
+ *
+ */
+ $view_folder = '';
+
/*
* --------------------------------------------------------------------
@@ -190,6 +207,22 @@ if (defined('ENVIRONMENT'))
define('APPPATH', BASEPATH.$application_folder.'/');
}
+
+ // The path to the "views" folder
+ if (is_dir($view_folder))
+ {
+ define ('VIEWPATH', $view_folder .'/');
+ }
+ else
+ {
+ if ( ! is_dir(APPPATH.'views/'))
+ {
+ exit("Your view folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF);
+ }
+
+ define ('VIEWPATH', APPPATH.'views/' );
+ }
+
/*
* --------------------------------------------------------------------
diff --git a/system/core/Loader.php b/system/core/Loader.php
index e7fa3d3f6..452dc0b4c 100755
--- a/system/core/Loader.php
+++ b/system/core/Loader.php
@@ -127,7 +127,7 @@ class CI_Loader {
$this->_ci_library_paths = array(APPPATH, BASEPATH);
$this->_ci_helper_paths = array(APPPATH, BASEPATH);
$this->_ci_model_paths = array(APPPATH);
- $this->_ci_view_paths = array(APPPATH.'views/' => TRUE);
+ $this->_ci_view_paths = array(VIEWPATH => TRUE);
log_message('debug', "Loader Class Initialized");
}
diff --git a/user_guide/installation/index.html b/user_guide/installation/index.html
index 5e8ab3883..84338e2e6 100644
--- a/user_guide/installation/index.html
+++ b/user_guide/installation/index.html
@@ -72,7 +72,9 @@ variables at the top of the file with the new name you've chosen.</p>
<p>For the best security, both the <dfn>system</dfn> and any <dfn>application</dfn> folders should be placed above web root so that they are not directly accessible via a browser. By default, .htaccess files are included in each folder to help prevent direct access, but it is best to remove them from public access entirely in case the web server configuration changes or doesn't abide by the .htaccess.</p>
-<p>After moving them, open your main <kdb>index.php</kbd> file and set the <samp>$system_folder</samp> and <samp>$application_folder</samp> variables, preferably with a full path, e.g. '<dfn>/www/MyUser/system</dfn>'.</p>
+<p>If you would like to keep your views public it is also possible to move the <dfn>views</dfn> folder out of your application folder.</p>
+
+<p>After moving them, open your main <kdb>index.php</kbd> file and set the <samp>$system_folder</samp>, <samp>$application_folder</samp> and <samp>$view_folder</samp> variables, preferably with a full path, e.g. '<dfn>/www/MyUser/system</dfn>'.</p>
<p>
One additional measure to take in production environments is to disable