Welcome Guest, Not a member yet? Register   Sign In
Changing the Default View Directory
#2

[eluser]KingSkippus[/eluser]
I'm pretty sure that's hideously unsupported, but the view directory is defined in the file system/libraries/Loader.php. I think that what you'll have to do is either replace or extend the CI_Loader class as described in the Core Classes section of the User Manual.

If I had to guess, and I haven't tested this so take it for what it's worth (Edit: Note reply below, I did test it and it works with 1.7.2 but not 2.0), I'd think that the best way to go would be to create a file named system/application/libraries/MY_Loader.php that is something like this:

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
* MY_Loader Class
*
* Custom Loader class that extends the base CI_Loader to override the location
* of the views directory.
*/
class MY_Loader extends CI_Loader {

    function MY_Loader()
    {
        parent::CI_Loader();
        $this->_ci_view_path = APPPATH.'custom_view_dir/';
    }
}

Substitute your view directory name in for custom_view_dir. APPPATH is a constant that points to the system/application directory. (Or in CodeIgniter 2.0, just to application, which will be a peer directory of system.) I suppose that if you wanted it somewhere else entirely on the filesystem, you could remove APPPATH and put whatever absolute or relative directory you wanted there, as long as it's readable by your web server.

Again, I haven't tried this, it's just a suggestion on a direction that might work. If I were you, I'd seriously consider using the default view directory. If you need to share a view library or something, you can use symbolic links to link your library to views. For exmaple (in your system/application directory):

Code:
sudo ln -s /path/to/view/library views


Messages In This Thread
Changing the Default View Directory - by El Forum - 07-18-2010, 07:03 PM
Changing the Default View Directory - by El Forum - 07-18-2010, 07:32 PM
Changing the Default View Directory - by El Forum - 07-18-2010, 08:08 PM
Changing the Default View Directory - by El Forum - 07-19-2010, 12:11 AM
Changing the Default View Directory - by El Forum - 07-19-2010, 01:44 AM
Changing the Default View Directory - by El Forum - 07-19-2010, 04:48 AM
Changing the Default View Directory - by El Forum - 07-19-2010, 04:52 AM
Changing the Default View Directory - by El Forum - 07-19-2010, 07:11 AM
Changing the Default View Directory - by El Forum - 07-19-2010, 07:17 AM
Changing the Default View Directory - by El Forum - 07-19-2010, 08:58 AM
Changing the Default View Directory - by El Forum - 07-19-2010, 11:15 AM
Changing the Default View Directory - by El Forum - 07-19-2010, 08:07 PM



Theme © iAndrew 2016 - Forum software by © MyBB