Welcome Guest, Not a member yet? Register   Sign In
Load multiple controller
#1

[eluser]Unknown[/eluser]
Hi,

I want to use multiple MVC-Blocks as parts of a webpage. (Calender,Login,Top10,...) At the end you can drag & drop parts of the page where ever you want on the page matrix.

I installed the "module seperation" but have no idea how to call multiple controller or is this way bad pratice? I red so mich topics in this forum but found no help for my solution (or i am to stupid for that :-) ...)

Can anybody help me?

Greetz
Chris
#2

[eluser]esra[/eluser]
You can use Modular Separation in conjunction with Coolfactor's View library and the EXT JS Javascript library.

Coolfactor's View library can be used to manage the view fragments (partials or blocks) appearing on the page and those view fragments can encasulate EXT JS code.

EXT JS provides the DD capabilities. Checkout the Desktop sample for EXT JS 2.0. It does allow windows to be dragged and dropped, minimized, maximized, restored, etc. At the moment, I do not believe there it has support for border drop targets where windows or panels could be locked to an area of a page, but I believe this is coming later. However, there is a Portal example that allows panels to be snapped into place in a drag and drop like matrix.

If you need dynamic blocks (partials) which need to access data or have views which need to execute functions, you can create dedicated helpers for individual views. To access data from a helper, you need to create an instance of the CI super object in the helper.

MVC was not designed to nest controllers in a hierarchy. There are other architectural models like PAC (Presentation-Abstraction-Control) and HMVC (Hierarchial-Model-View-Controller) that are designed to manage hierarchies of nested controllers. Adapting CI to support HMVC or PAC requires some major core modifications, but it's possible. HMVC uses the Chain of Resposibility design pattern and containers to nest controllers in a hierarchy. PAC uses the Mediator design pattern. If you wanted to investigate this further, the Fluffycat site has sample PHP code for implementing both Chain of Resposibility and Mediator. The Chain of Resposibility sample is close to the original HMVC apporach posted in JavaWorld. The Mediator example lacks support for an abstract Mediator requiring some additional research of the web or by reading an advanced book of design patterns. Much of the information about PAC is difficult to find because most of the documentation was written for IEEE articles which are only downloadable via membership. However, you can find white papers and other articles about implementing PAC on Java and C++ which could be adapted to PHP.




Theme © iAndrew 2016 - Forum software by © MyBB