include/echo output of PHP
I got two projects running, both written in PHP. Now I want to merge these two projects. The first project is a CMS and on a specific page i will display the contents of the other project / application. I don't want the first project to know about, or get access to, the variables and functions in the other and vice versa. So i just want the CMS, the first project, to receive the contents of o开发者_JAVA技巧utput of the other project.
I don't want to make another http-request – using get_file_contents or cURL because of load-time. I find passthru()
and system()
hard to get working, but if that is a possibility, please teach me the way.
I also need to pass some variables from the first project to the other on execution, controller_id
and model_id
.
Thanks in advance!
EDIT: Iframes and load via javascript is not an option in consideration of accessability guidelines.
You have several options you already discarded:
- server side integration at code level (include, etc...)
- server side integration via curl
You should therefore probably rely on client-side integration:
- load content via AJAX (best option for me): see Jquery load function, for example. You can pass any parameters, and data, and everything should work
- load content via iframes
maybe you could use an iFrame and pass some stuff via the query string... allthough that's another request on load...
What version of PHP are you running? You could always port the portion of the app that will, for all intents and purposes, be considered the "child" to a seperate namespace, effectively cutting it off from all the rest of the app and vice-versa.
Check out the manual entry on Defining Namespaces to see if it's for you
精彩评论