سؤال

I was trying to integrate opencart and phpbb but got into issues By integration I mean, when user logs into opencart or phpbb they get logged onto both the sites(which worked fine for me since it only involved inserting the relevant data in opencart DB at time of login into phpbb and vice versa)

The issue happened when I have to start getting phpbb posts in the opencart page itself I followed this thread

wiki.phpbb.com/Practical.Displaying_posts_and_topics_on_external_pages

Eventually following line includes almost all the classes/functions in phpbb

include($phpbb_root_path . 'common.' . $phpEx);

Now, there are clases with same name in both(for instance Cache, Session, Template) I renamed all the conflicting classes in PHP to proceed but found out that there are global variables with same name. Even the global variables like $db had same names For common functions also, I just have to delete duplicate functions carefully

Can someone tell me what is the way to integrate two php applications which have common class names, functions and global variables

I was thinking if nothing else works, I would access phpbb from opencart as ajax request/response so that phpbb is still a different application. For instance, issue an ajax request to get the posts (by passing topic id to say http url/forum and read the response I get from the script) and write this response in the opencart screen

هل كانت مفيدة؟

المحلول

Here You probably have only one option: let the OC or BB run in subfolder/subdomain/different domain, etc. Do not integrate them as You are mentioning.

Instead of this create some own API (this would be the cleanest way) on the BB side and an API client on the other one (API will contain methods providing the required data).

The other solution is to implement new model(s) in OC (maybe by just copying from BB) that will directly read data from BB database so that You can call them in Your OC controllers and display the data the normal way OC does... This is also considered clean solution.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top