Welcome Guest, Not a member yet? Register   Sign In
Retrofitting App to use CodeIgniter
#12

[eluser]sophistry[/eluser]
dc, i just noticed you are using the chdir() function in your modified code.

i assume you are doing that because the CWD is actually the directory where CI starts off (where index.php is) rather than where the view is located. i think this is an interesting solution to potential path problems with old code in old sites that weren't designed to be "moved" to new locations. that is, pure relative paths in include() and require() calls get messed up.

for instance, if you have a script with
Code:
include('separate_file_in_same_directory');
PHP won't be able to find it. but if the clever programmer put in some "portability" code like this:
Code:
include(REAL_LOCATION_OF_THIS_FILE.'separate_file_in_same_directory');
then, moving it a new system like this site_migrate controller will have no problem dealing with it.

my only concern with using chdir() to the view file is that there may be other things the CI is doing after the $this->load->view() method that could potentially get confused if the CWD is changed. i am not sure about the implications, but i decided to solve the problem another way.

instead of using chdir() to help old scripts scope themselves, i just went in a modified the scripts.

however, your solution may be better in the long run. i'll try it out, but could you let me know if you get into any problems with chdir() yousrself? thanks.


Messages In This Thread
Retrofitting App to use CodeIgniter - by El Forum - 09-12-2008, 09:25 AM
Retrofitting App to use CodeIgniter - by El Forum - 09-12-2008, 11:37 AM
Retrofitting App to use CodeIgniter - by El Forum - 09-15-2008, 04:12 AM
Retrofitting App to use CodeIgniter - by El Forum - 09-15-2008, 04:27 AM
Retrofitting App to use CodeIgniter - by El Forum - 09-15-2008, 07:56 AM
Retrofitting App to use CodeIgniter - by El Forum - 09-16-2008, 07:01 AM
Retrofitting App to use CodeIgniter - by El Forum - 09-16-2008, 11:43 AM
Retrofitting App to use CodeIgniter - by El Forum - 09-16-2008, 12:09 PM
Retrofitting App to use CodeIgniter - by El Forum - 09-16-2008, 02:13 PM
Retrofitting App to use CodeIgniter - by El Forum - 09-17-2008, 01:37 PM
Retrofitting App to use CodeIgniter - by El Forum - 09-17-2008, 07:32 PM
Retrofitting App to use CodeIgniter - by El Forum - 09-18-2008, 10:08 AM
Retrofitting App to use CodeIgniter - by El Forum - 09-18-2008, 12:19 PM
Retrofitting App to use CodeIgniter - by El Forum - 09-18-2008, 12:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB