Welcome Guest, Not a member yet? Register   Sign In
MVC within MVC (not view within view)
#1

[eluser]sdbruder[/eluser]
view within views appears to be a FAQ everywhere, but all responses that I saw until now was the "dumb views" type, like "load static header" your content here "load static footer".

What if I have a MVC for a frontpage with configurable "slots" (left / right column, etc), with "10 ten news", "5 most recent podcasts", "static block", etc.

Any block is a MVC in itself (its own controler, its own view, etcetera).

Any way to do this with CI with minimal fuss?
#2

[eluser]Rick Jolly[/eluser]
You could call a helper from the main layout view that loads a specified library that returns the complete partial view. Maybe something like this example: http://ellislab.com/forums/viewthread/59644/#293774
#3

[eluser]sdbruder[/eluser]
exacty, Hierarchical Model View Controller (HMVC) pattern does the trick.

The idea is creating controllers for my sub-blocks and instead of putting it in application/controllers/, put them in application/libraries/ ?

I'll try.
#4

[eluser]Rick Jolly[/eluser]
The "controllers" for the subblocks should actually be libraries - they just act like CI controllers.
#5

[eluser]Crafter[/eluser]
If CI can acheive this, I'll be on my way to building the perfect CMS Wink.




Theme © iAndrew 2016 - Forum software by © MyBB