Any modular system is going to be written to meet specific needs. The main issue that I see with CMS-rivaling system is the need to tie it in at all stages of the application: model, view and controller. Modules themselves would need a database presence, requiring models. A notification system that triggers callbacks. Customisable view handling. Flexibility.
Starting the process with a component and finishing with a helper is a good idea to tie it together at the ends, but I see a module system as being seperate from the MVC paradigm. Or perhaps each module as a mini MVC application throughout a larger one. Or I may have hit my head recently... On Jul 8, 9:38 pm, James K <[email protected]> wrote: > A helper in conjunction with elements would likely be the closest > thing you'll get to a Joomla module. Elements would contain the > presentation logic for each "module", and the helper could be written > to act like a "module bucket" - pull in the modules for that page, > pass data to the elements and render them to a position in your page. > > Helpers have the same limitation as views or elements, however, in > that they do not have direct access to any Models as they are also > view-scoped. You'd still have to use App::import to bring in your > models and run your queries. > > If you're not concerned with encapsulation, you'd be looking at a more > involved approach like Robert suggested. Personally, I would probably > go with something like a Component, that runs logic in beforeFilter to > gather the data to support the modules on the page, and beforeRender > to send the data to the view in a format that the Helper can read and > then render to Elements. > > Action agnostic data access is an interesting problem in CakePHP as > the framework was very specifically built such that all of your > queries will be happening at the Controller Action level - this makes > it difficult when you need to pull data that is non-specific to the > action, but to a higher level entity like a "page" (if you were > building a CMS, for instance). > > If you get something working well, myself, as well as others, would be > interested in hearing about the approach you went with. > > - James > > On Jul 8, 1:00 am, Shadab Shaikh <[email protected]> wrote: > > > Hello James & Robert, > > > Thanks for sharing your ideas with me. > > But I think we should use Helper rather than element would be good idea as > > element having certain limitation but helper is more extensible. > > > If any one having other idea please share with us. > > > Thanks! > > Shadab Shaikh > > > On Wed, Jul 8, 2009 at 12:14 AM, James K <[email protected]> wrote: > > > > There is no entity in CakePHP that work like Joomla modules out of the > > > box. The closest thing would be elements - elements are "mini-views" > > > that can be included in layouts or views. However, since they are > > > intended to be reliant on the information passed to the view they're > > > included in, they lose the main bit of a Joomla module's functionality > > > - namely the ability to be fully self-contained and make their own > > > database calls. > > > > You CAN use App::import within an element to include the model(s) you > > > need, and run queries on them but this not very efficient as you may > > > end up with several complete instances of the same model being > > > generated in a single request. > > > > - James > > > > On Jul 7, 1:44 am, shadab <[email protected]> wrote: > > > > Hello All, > > > > > Greetings of the day! > > > > > I want to develop some robust application in CAKE PHP. I would like to > > > > use Joomla module idea in it. Let me clear what is Joomla module, who > > > > are not familiar with Joomla. Joomla module is logic with interface > > > > which can placed at multiple pages at well defined position of the > > > > pages. We can easily make it enable/disable it and change it position > > > > any time. For e.g. “online friends” is one module which can be placed > > > > in different pages at well defined position. > > > > > would like same thing to develop in CAKE PHP to accomplish below goal > > > > • We can create module by simply adding files and db entries > > > > • We would have generalized function to load modules but once I want > > > > to create new module than I need not require to touch my controller’s > > > > logic, just need to db entry and adding necessary files > > > > • We can easily enable/disable modules to any page by db may be > > > > using > > > > flag > > > > > Now my questions > > > > 1) What would be best things in cake php to create this kind of > > > > module? Whether I should go with helper or anything else? > > > > 2) I am open for suggestions/discussions. Please send me your > > > > views/ > > > > ideas to accomplish above goals. > > > > > Thanks in advance. :) > > > > > Best Regards, > > > > Shadab Shaikh --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
