[Solved] How to pick up main application folder from another directory. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: [Solved] How to pick up main application folder from another directory. (/showthread.php?tid=60639) |
[Solved] How to pick up main application folder from another directory. - El Forum - 05-16-2014 [eluser]riwakawd[/eluser] Just have been trying to use FCPATH to pick up main application folder. I have an sub folder which contains another index.php and application folder. As shown in images Because I have a sub folder with own index.php and application. The FCPATH is picking up that location Code: <td><?php echo FCPATH . 'application/config/database.php'; ?></td> The above html make display C:\xampp\htdocs\codeigniter\install\application/config/database.php What would like it to be. Trying to pick up the application folder up one or two levels basically C:\xampp\htdocs\codeigniter\application/config/database.php With out install. I would like it to be able to pick up main application folder and not the one in the install folder. [Solved] How to pick up main application folder from another directory. - El Forum - 05-17-2014 [eluser]Tim Brownlaw[/eluser] So if you only want to wonder up one level One way is to use dirname(FCPATH); instead of FCPATH! That'll take you up One Level and remember that it is a path! But you'd could also use dirname(__FILE__) and create a new define based upon that... You could also use str_replace to replace the "install/" with nothing, thus removing it... As you can see, there are various ways. [Solved] How to pick up main application folder from another directory. - El Forum - 05-17-2014 [eluser]riwakawd[/eluser] [quote author="Tim Brownlaw" date="1400326802"]So if you only want to wonder up one level One way is to use dirname(FCPATH); instead of FCPATH! That'll take you up One Level and remember that it is a path! But you'd could also use dirname(__FILE__) and create a new define based upon that... You could also use str_replace to replace the "install/" with nothing, thus removing it... As you can see, there are various ways. [/quote] I also tried this <td><?php echo $_SERVER["DOCUMENT_ROOT"] . '/application/config/database.php'; ?></td> but did not pick up the project folder in my xampp. C:/xampp/htdocs/application/config/config.php trying to get it C:/xampp/htdocs/codeigniter/application/config/config.php [Solved] How to pick up main application folder from another directory. - El Forum - 05-17-2014 [eluser]riwakawd[/eluser] [quote author="Tim Brownlaw" date="1400326802"]So if you only want to wonder up one level One way is to use dirname(FCPATH); instead of FCPATH! That'll take you up One Level and remember that it is a path! But you'd could also use dirname(__FILE__) and create a new define based upon that... You could also use str_replace to replace the "install/" with nothing, thus removing it... As you can see, there are various ways. [/quote] Your way worked thanks so much. Code: <tr> |