• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accessing CI methods from external script? (CI v2)

#1
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)
Reply

#2
Why not create a controller that does the job and access it with CLI?
Reply

#3
Because I am not able to access the CLI. I specifically need to do it this way.
Reply

#4
@mr_pablo

https://github.com/ivantcholakov/starter...c/demo.php
http://iridadesign.com/starter-public-ed...c/demo.php

See how this page works. If it is what you need, download the whole project. I have no a quick separate solution.
Reply

#5
(03-18-2015, 04:00 AM)ivantcholakov Wrote: @mr_pablo

https://github.com/ivantcholakov/starter...c/demo.php
http://iridadesign.com/starter-public-ed...c/demo.php

See how this page works. If it is what you need, download the whole project. I have no a quick separate solution.

This looks like it may help.

Can I use this alongside my CI v2 app without issues?
Reply

#6
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/in...e_300.html
Reply

#7
(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/in...e_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.
Reply

#8
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...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.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.