Accessing CI methods from external script? (CI v2) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Accessing CI methods from external script? (CI v2) (/showthread.php?tid=1516) |
Accessing CI methods from external script? (CI v2) - mr_pablo - 03-17-2015 I have an external script (sat in the root folder, alongside CI's index.php) that ideally I need to access CI's methods e.g. models. I found this article, but its outdated. I even tried the answer here, but that didn't work. So, is there a way to achieve this? (I fully understand it may not be secure or best practice, I'd just like to know if it's possible, and how to do it) RE: Accessing CI methods from external script? (CI v2) - Avenirer - 03-18-2015 Why not create a controller that does the job and access it with CLI? RE: Accessing CI methods from external script? (CI v2) - mr_pablo - 03-18-2015 Because I am not able to access the CLI. I specifically need to do it this way. RE: Accessing CI methods from external script? (CI v2) - ivantcholakov - 03-18-2015 @mr_pablo https://github.com/ivantcholakov/starter-public-edition-3/blob/master/www/non-mvc/demo.php http://iridadesign.com/starter-public-edition-3/www/non-mvc/demo.php See how this page works. If it is what you need, download the whole project. I have no a quick separate solution. RE: Accessing CI methods from external script? (CI v2) - mr_pablo - 03-18-2015 (03-18-2015, 04:00 AM)ivantcholakov Wrote: @mr_pablo This looks like it may help. Can I use this alongside my CI v2 app without issues? RE: Accessing CI methods from external script? (CI v2) - ivantcholakov - 03-18-2015 You may try to migrate the application. I still support the older CI2 class/file naming convention, probably most of your code will work without modifications. But check the CI2 -> CI3 migration notes: http://www.codeigniter.com/userguide3/installation/upgrade_300.html RE: Accessing CI methods from external script? (CI v2) - mr_pablo - 03-18-2015 (03-18-2015, 04:21 AM)ivantcholakov Wrote: You may try to migrate the application. I still support the older CI2 class/file naming convention, probably most of your code will work without modifications. But check the CI2 -> CI3 migration notes: http://www.codeigniter.com/userguide3/installation/upgrade_300.html So I shojuld put the "platform" directory alongside my current CI application? Or is there a way to use my current CI application with the additional parts you have made? As I can see you include a CI installation inside your "platform" directory, but I don't really want another CI app, when I already have the files for one. RE: Accessing CI methods from external script? (CI v2) - ivantcholakov - 03-28-2015 You can move directories, I don't have documentation about it. Just trace code starting from index.php and you will figure out how to rearrange directories as you wish. See this file for example: https://github.com/ivantcholakov/starter-public-edition-3/blob/master/www/config.php Edit: I checked, actually within README.md, in the Installation section there are some words about $PLATFORMPATH. If you want, you may "merge" the folders www/ and platform/ into one folder that would be your web-server root folder, but I don't recommend that, the installation would be less secure. Edit 2: For further questions open an issue on the project's page for not polluting the forum here with irrelevant stuff. |