Welcome Guest, Not a member yet? Register   Sign In
chdir() breaks $this->load->view()
#1

[eluser]Unknown[/eluser]
Is this expected behaviour? Performing a chdir() before $this->load->view() prevents the view from loading. The View documentation doesn't say anything about the paths being relative (File_Helper claims to be relative to the index.php).

Controller:
class Blog extends CI_Controller {
public function index()
{
chdir('/tmp');
$this->load->view('blogview');
}
}

View:
Hello World
#2

[eluser]Aken[/eluser]
I don't think needing to use chdir() is very common with CodeIgniter applications. So while it isn't "expected" in that sense, it is not an error.

The Loader class does use relative paths, which start with the APPPATH constant defined in the index.php (using the $application_folder variable).

You can solve this by setting your application (and maybe your system) path to the full absolute location in index.php.

Code:
$application_folder = '/Users/aken/Localhost/example.com/application';




Theme © iAndrew 2016 - Forum software by © MyBB