Welcome Guest, Not a member yet? Register   Sign In
using codeigniter in non-codeigniter application
#1

(This post was last modified: 11-13-2015, 02:50 AM by nasser.man.)

I have an opencart shopping site, and i have created a small codeigniter application, i think how i can call codeigniter application within opencart ( or any other non-codeigniter application)?

for example i have a simple controller :
/mysite / ci-app / my-controller / func / param1 / param2

and my store :
/mysite/

currently i used iframe in opencart's template for display ci-app, but i wonder how i can call codeigniter's cntroller/library/model/helpers whitin custom application?

which files i have to include to access &ci instance?
ressan.ir
CI is nice Heart
Reply
#2

i'm not sure but if you have access to your CI output and you need this in a variable or something like that - why not use file_get_contents ?
Reply
#3

i found this page:

http://www.badpenguin.org/use-codeignite...al-scripts

is there any way to add minimum (just needed files)?
ressan.ir
CI is nice Heart
Reply
#4

according to your first post - you told us that you use iframes 
that indicates that you just need the content which CI delivers -

i just tried from localhost a call to a vhost where CI runs with file_get_contents and it worked perfectly fine
just do something like this:


PHP Code:
echo file_get_contents("http://".$_SERVER['HTTP_HOST']."/your_relative_url/"); 

Another option i'm aware of is the curl extension -> CURL


If you want all member variables thats a total different problem and in my opinion the solution isn't an include Wink
Either way, in this case you should really say what exactly it is what you want.
Reply
#5

For the most part, the minimum is going to depend on the code you're trying to run. You would be trying to replace index.php and /system/core/CodeIgniter.php, which are the files which essentially load the application and create the CI super-object.

Whether you need every file loaded by CodeIgniter.php to get the output depends on your application and your CI code. Additionally, you have to consider every file loaded and used by your CI code.

In the end, unless you need to do this for a large amount of CI code, it's likely that it would be faster to port the other code to CI or port the CI code to something which better fits your needs. If you need it to continue to be accessible as a CI application while also being used by the other application, you can thin out the controller(s) and make most of the application code a little more portable by using PHP classes which could also be loaded by other applications. This would make most of the CI-specific code an interface between those classes and the CI application, rather than having your logic intertwined with framework-specific code.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB