开发者

How to merge two MVC systems in PHP?

开发者 https://www.devze.com 2023-01-10 21:06 出处:网络
I am working with two MVC systems that need merged. It appears both use different session variables and different cookies. The main problem I have is trying to get each one to pass sessions variables

I am working with two MVC systems that need merged. It appears both use different session variables and different cookies. The main problem I have is trying to get each one to pass sessions variables back and forth, which it does not want to do.

What is the best way to go about merging the two?

开发者_JAVA百科

Update: I am trying BlueImp chat with another MVC that is written from scratch. The sessions are not playing nicely.


Aside from as others have said this sounds like a baddd idea. The best route to take if you REALLY want to do this would be to integrate each module of each MVC.

Ie. integrate the models into one solidified unit, as well as controller and views and the end result is a mashed up MVC of your own taste.

Post some code perhaps someone can help work through this.


Turns out yes, you don't want to try this, especially if there is javascript mixed between the two.

a) session merging:

BlueImp uses a flat file for user access. This was quickly traced and re-routed to the correct user table in the login function.

b) output control

since blueImp uses XML for output, using a jQuery div controller simply doesn't work. So I was forced to use the dreaded IFRAME. This works.. up to a point. Any parameters must be passed with GET variables.

c) IE, the dreaded DOM parse.

So sorry, but a single javascript error crashes any and all further code execution. In other words, IFRAMEs can fail if the parent page spawns an error. Suppressing error reporting only works so far.

RESULT it is possible to mix MVCs, but only if you can properly balance all three of the above. Unfortunately, with this project, too many javascript errors blocks the proper functioning with a brick wall. Also, unfortunately, there is no other solution, since chat apps seriously need proper AJAX handshaking to work properly. And well if the parent MVC is crashy, it casades downwards through everything else.

My conclusion, MVCs are nice and all, but PHP function libraries are much nicer... (and also how 99% of the PHP language set works.)

Yes, not a complete solution, but hopefully this will help anyone else that attempts to do this.

0

精彩评论

暂无评论...
验证码 换一张
取 消