CodeIgniter Forums
Cells - Printable Version

+- CodeIgniter Forums (
+-- Forum: CodeIgniter 4 (
+--- Forum: CodeIgniter 4 Feature Requests (
+--- Thread: Cells (/showthread.php?tid=61509)

Cells - gadelat - 04-21-2015

From CakePHP 3 docs:

"Cells are ideal for building reusable page components that require interaction with models, view logic, and rendering logic. A simple example would be the cart in an online store, or a data-driven navigation menu in a CMS. Because cells do not dispatch sub-requests, they sidestep all of the overhead associated with requestAction()."

In my opinion this allows to solve current problem in codeigniter of creating reusable logic without the need for controversial HMVC support.

RE: Cells - ivantcholakov - 04-21-2015

It sounds like HMVC, under a different name.

RE: Cells - mwhitney - 04-21-2015

At some level it is similar to HMVC, and the general concept goes under many names. I think that HMVC extensions for CI tend to group together two or three concepts: partial views, View Models/Presenters/Adapters, and a modular directory structure (modules containing their own MVC directory structure).

One of the nice things I see in CakePHP's Cells is the isolation of scope, so the Cell doesn't see the variables loaded into the view (and the view doesn't see the variables in the Cell).

RE: Cells - ivantcholakov - 04-21-2015

Call it whatever you like.


RE: Cells - InsiteFX - 04-22-2015

I would call it a component!

RE: Cells - Avenirer - 04-22-2015

That would be a good addition, whatever you call it...

RE: Cells - kilishan - 05-15-2015

I really like this idea, too. No matter what you call it.

I built a similar thing in to the view library of Sprint that takes a text string that defines the class, the method and a named parameter list. The function then tries to autoload the class (so any namespaced class works). If that doesn't work, it assumes it's a CodeIgniter library and tries to load it. It's a super simple thing that's very flexible.

I bring that up only to say that there's no reason for something like this to be nearly as structured as the way that Cake is doing it, and you can still get some great results.