mirror of
https://github.com/bcit-ci/CodeIgniter.git
synced 2025-02-20 11:13:29 +08:00
changed code to pass the new "document root" to the view files that are loaded
parent
53a321bc38
commit
7bf26d800d
@ -66,12 +66,23 @@ class Site_migrate_base extends CI_Controller {
|
||||
// append the default_view string if ruri targets a directory
|
||||
$server_path_to_view = APPPATH.'views/';
|
||||
$view_file = (is_dir($server_path_to_view.$view_file)) ? $view_file.'/'.$this->default_view_and_method : $view_file;
|
||||
// change the current working directory
|
||||
// to support relative include/require paths
|
||||
// 20110625 removed chdir() for temporary compatibility with CI2
|
||||
// chdir(dirname($server_path_to_view.$view_file));
|
||||
$this->load->view($view_file);
|
||||
//chdir(dirname(FCPATH));
|
||||
// MODIFIED: 20110627
|
||||
// you must make a change in your migrating code - the old
|
||||
// site must be modified if site_migrate is to support it -
|
||||
// it must think it is still the front most file being
|
||||
// served by apache in its own document root...
|
||||
// only now, the document root will be the site_migrate directory
|
||||
// where you just dumped the old site to be migrated
|
||||
// pass the docroot variable to the "view" file so that it can be used
|
||||
// in scripts that need the absolute path to the view file
|
||||
// this lets us refer to the new "docroot" in any scripts
|
||||
// most basic migrating sites won't need this, but...
|
||||
// use it in any files in the old site that need to believe they are at document root:
|
||||
// chdir($site_migrate_docroot);
|
||||
// make sure you put it before ANY require()s, or include()s for files
|
||||
// in the relative path
|
||||
$site_migrate_docroot = dirname($server_path_to_view.$view_file);
|
||||
$this->load->view($view_file, compact('site_migrate_docroot'));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user