Converting an MVC app to HMVC in CodeIgniter - php

I have an App in CodeIgniter built using the regular MVC pattern. If I want to switch to HMVC then I have to move all Models,Views and Controllers to the modules folder? I don't understand if in HMVC everything is a module or both Modules and the old MVC structure can coexist.

H in HMVC stands for hierarchical, the files in your normal controllers,vews and models folders are on top of the hierarchy. This means that you can still use or old controllers,models,views folders. These folders will then be accessible by all modules in your system.

Related

True HMVC/PAC in kohana PHP framework

I'm new to PHP and use of PHP frameworks. I chose Kohana PHP as my framework for a project I am working on (instead of alloy, also because it's the least complicated). Is there a way to implement MVC triad hierarchy in my Kohana project?
folder (root folder for mvc)
-|-subfolder
----models
----views
----controllers
-|-subfolder 2
----models
----views
----controllers
If anyone could help me in routing and forms for this kind of implementation, I would gladly appreciate it :)
note: I did browse through kohana's 3.3 docu, and I just don't get how to actually implement this
You can use one 'system' and 'modules' directory and different 'application' folder in one project. But there are some problems with routing(its really ugly) and code duplication (logs, configs etc.)

How to separate admin files and folders from public files and folders with Zend Framework 2?

i'm new in zend framework 2
i want to write a simple cms using zend framework2, but in start i want to separate the admin modules(files and folders) from the public.
i was built a simple cms before with this strategy
-public
-admin
index.php
-other folders related to admin
index.php
about.php
-other folder and files related to public view
can anyone give me a simple Cms building with Zend framework 2 or explain for me what to do?
sorry for my bad English
thanks
A ZF2 module can already contain its own routes, controllers, views, and public resources (the latter via the zf2-assetic-module). A single ZF2 app with two self-developed modules - one for the front-end and one for the admin back-end - should satisfy your separation criteria.
Note that you would typically still use a single public/index.php with a single .htaccess routing all non-resource (img, css, js, etc) requests to that index.php file.
Sounds to me like a deeper understanding of how ZF2 works would address most of your questions.

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.

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

Sharing controllers, models and views between separate projects in CodeIgniter

Kohana, due to cascading file system and modules, allows to share code in common projects, that contains controllers, views and models directories. How can I do it in codeigniter? I want to create sites, that will share some code (admin area views, some models). That is easy in Kohana, we just have to add another directory for Kohana::find_file().
I think this is a duplication of:
Codeigniter Shared Resources - Opinions Wanted
And
How do I load a view from a specific (shared) path in CodeIgniter?
I'm more experienced in Kohana than CI but if I'm right there is a HMVC module in CodeIgniter. You could see if you are able to request a external page like you can with the HMVC of kohana.
If I may ask. why do you use codeigniter when you know kohana does the job better?

Categories