Building any kind of module/modular system has certain complexities,
and if there is any form of public implementation it's unlikely to be
"one size fits all". The first thing is to be very clear what
funtionality you want from the system, and what behaviour you want it
to exhibit.

Modules relate to other content? Accessible through database entries?
Sounds like a Model to me.

    class Module extends AppModel { // fields: id, name, active
        var $hasMany = array('ModuleSetting');
        var $hasAndBelongsToMany = array('Page');
        function load($modelName) { // static function
            // find
            // include
            // instantiate
        }
    }

    class ModuleSetting extends AppModel {} // fields: id, module_id,
name, value

(I left out the controller, but you can use your imagination...)

Modules placed in pages? Make it easy with a Helper.

    class ModuleHelper extends AppHelper {
        var $modules = array();
        function region($regionName) {
            $output = '';
            foreach ($this->modules as $module) {
                if ($module->region == $regionName) {
                    $output .= $module->output();
                }
            }
        return $this->output($output);
        }
    }

    $module->region('left sidebar');

This is just a rough idea from someone who has very rough ideas. The
subject is one I am more than slightly interested in though,
especially in relation to Cake.

On Jul 7, 1:44 pm, 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to