Kohana 3 How to render module inside application - php

How to integrate module inside application? I have modules having two controllers and two respective views inside module. Now I want to integrate this module inside my application, so that views and actions can be handled by this module only.

Note that your Application, modules and System files may intersect. Use this picture to understand Kohana cascading filesystem:
So, if both application and your module have a views/welcome.php, application one will be found. When two modules have files with the same path, Kohana will select module with highest position in Kohana::modules() list.

Once you have created the module enable it in the application bootstrap.php then you should be able to visit [your-website]/modualController/action you might need to look at routes.
This is a great resource for modules and routing, and everything else Kohana http://kerkness.ca/wiki/doku.php

Related

Module Separation

I'm trying to figure out how I can work with module separation with codeigniter.
Lets say I have a news module where its inside of the application folder and inside the news module folder I have a controllers, models, views folders and files inside of those.
Do I need something additional to do this?
If you want to work with modules in codeigniter you can use Modular Extensions - HMVC which makes codeigniter modular. Here is the link https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home
I hope this helps.

ZF2: own Defaults for Module based Application

I want to write a php application using Zend Framework 2 (just the beta 2 yet).
Because it's going to be a collection of several webservices I decided to seperate it into different modules (with own databases).
Before starting to write the first module I want to write the code wich each module should need. For example the layout. Each module uses the same layout. That's why I want to write it globally to improve the development process of single modules.
How can I provide defaults for each module globally? (e.g. layout, plugin, default database model, ...)
In ZendFramework2 configurations from all modules are always merged.
Additionally there is a global config which can overwrite module-wise config.
So including a vendor module brings in a default configuration you can and should overwrite via your global config.
The global config may consist of multiple files making it easy to distinguish between modules-to-be-configured.
The first example I have is an article of akrabat about module configuration and overrides.
Another nice example of this pattern is Akrabat's quickstart (https://github.com/akrabat/zf2-tutorial):
one App module, based on ZendSkeletonApp
one Album module, the part you actually did.
In the App module there is config for the basic routing, Views and the Layout are set up
In the Album module there is only the set-up for Album-specific things (e.g. dependency injection), the view and routing are used from the App-modules config.
You may decide to overwrite this config on a per-module basis or globally, in the default project layout your configs are placed like this:
/config/application.config.php the base configuration
/config/autoload/*.config.php may be used to overwrite modules or app config (e.g. for local development)
/module/[your-module]/config/[your-module].config.php the default configuration of your module
/vendor/[vendor-module]/config/[vendor-module].config.php a module you dropped in, but has definitions for it's dependency injection. if it uses e.g. a database you want to overwrite some parameters in your /config/autoload/*

Zend Framework multiple modules with admin

I am currently planning on a pretty big project that would be split in 4 modules.
Core module (default) - manage ACL, Auth and relations between other modules
Sections - Will separate the differents section of the application and will act as a timeline / progress bar (Locked and unlocked sections based on progress)
CMS - Will provide global content and section specific content
Exams
For those module I will have to develop a back end to edit content/right and so on. What would be the best way to create these?
For now I see two options (there might be more) :
Build the frontend with modules and controller and create a controller within the module with an admin_ prefix
Create an other module for each module, like : core, core_admin, sections, sections_admin, etc.
This depends on how loosely coupled you want to make your modules.
If the modules themselves are never going to move between projects, an admin module might be the simplest solution. The downside to this is that the admin module will be tightly coupled with the other modules. This is the most logical approach from your description.
If you want to keep them loosely coupled, creating separate modules as you mentioned is probably your best route.
Alternatively, if there is not a whole lot to manage, you could always simply create an AdminController in each module and have individual actions for all the various admin tasks. This would get messy as the project grows though.
With any of the loosely coupled choices, you may want to look at using the Zend Regex Router so you can provide a more consistent route to your admin interface.

Codeigniter HMVC modules structure

I'm working on a content management system in Codeigniter with the Datamapper and HMVC extension. My question is, how to handle submodules.
Example:
I want to create an User module which exists from Users, Usergroups, Rights and Modules. In codeigniter I have build it now like this:
Codeigniter root
application
modules
Users
models
user
right
usergroup
module
Is this the right way to fix it or am I doing it wrong?
You can't have submodules in HMVC without extending the MY_router class.
You have a nice tutorial here: HMVC: an Introduction and Application

codeigniter HMVC extension model organization

I am developing a portal and using codeigniter with HMVC extension. I have an "admin" module and a "yellowpages" module. Both these modules have a common model eg: "Category_model", and I use it to list down the categories both in the frontend(yellowpages) and backend(admin) module.
So my question is, can I place the model in the application/models directory and have it accessed by both the modules, or do I have to copy the model and place each copy inside /modules/admin/models and /modules/yellowpages/models
Resources may be cross loaded between
modules. ie:
$this->load->model(‘module/model’);
More info here and here

Categories