Can I use the HMVC pattern in the Zend Framework? It is implemented in Kohana 3 by default, and I really like it, so now I want to use it in the Zend Framework.
Edit
I want to make it possible: 1) to include a full request (for example, a controller / action) inside another request 2) to make a direct call to the controller / action, as described above
It is used not only for widgets, but also I want to create a page containing the contents of other pages ...
Edit 2
To be more clear: I have a page object that contains several elements. These elements can be simple elements (text, image, etc.) and special elements that are controllers: action calls. Each page may contain "unlimited" (special) elements. I just want to skip these elements, determine which element I am referring to, and add the result of this element to the contents of my view.
Like:
foreach($Page->Elements AS $Element) { switch(get_class($Element)) { case "Base\TextElement": // Add text element to content ... break; case "Base\SpecialElement": // Get result of the controller:action call break; case "Base\ImageElement": // Add image element to content ... break; default: echo "No case defined for ".get_class($Element); die; } }
source share