
Originally Posted by
quentinjs
If you want to keep all your stuff neat and tidy in a subdirectory off of say admin, like admin/reports then there is some tricks you need to employ to make sure that the includes work properly.
1. All html paths saying 'include/xxxx' need to be changed to '../include/xxxx'
2. The "require('xxxx') statements need to be changed as follows
<?php
$qcd = getcwd();
chdir('../');
require('xxxx');
chdir($qcd);
?>
basically this moves the directory back, does the "Require" and then moves you back to your subdirectory. Now there is more elegant ways of doing this, but that would require recoding the entire zencart base files.... not a job on my to-dlo list currently.
There may be other required changes, but this should hopefully help out those wanting to do this.
Could this method be used to move down a directory as well?
If I have my files that I want to have access to application_top.php in the website root a directory above /shop/, would this work, or are there limitations?:
PHP Code:
<?php
$qcd = getcwd();
chdir('/shop/');
require('xxxx');
chdir($qcd);
?>
Also, are there limitations that you, or anyone else has found using your exact workaround?