Welcome Guest, Not a member yet? Register   Sign In
question about mvc and widgets
#1

[eluser]Davcon[/eluser]
In a recent previous thread I discussed my need to switch from HMVC back to MVC (i.e., out of the box Codeigniter).

As a slightly more technical follow up to this conversation I have a question about widgets.

What are the best practices for dealing with widgets in MVC?

Please consider the following challenge:

Imagine you've built a fully functional website using Codeigniter. Then one day you decide that you'd like to have a little events diary appearing on the top right hand of all of your webpages.

In HMVC this would be easy because we can call other controllers (even modules no less!) from view files. So, we would build our website as normal. We'd then build our calendar app as normal and then we'd link them by modifying one file - some sort of template file (and I know that some of us can't agree on how to handle templates but let's leave that conversation for another day).

My challenge is that I can't figure out how to achieve the same kind of thing with out of the box Codeigniter (using MVC).

I've read a few posts with people suggesting that we should make our controllers create big giant html strings and pass those back and forward, but to me that seems a bit stone age.

Can anyone therefore offer a clear verbal explanation of how best to handle widgets with out of the box CI?

Many thanks! Peace, love and vegetables!
#2

[eluser]Davcon[/eluser]
Not one answer. Interesting.

I shall ponder the meaning behind this.
#3

[eluser]kerell78us[/eluser]
I use Widget Plugin by Wiredesignz with my project.

All my widgets are stored in my database and managed from my backend; with configurable values such as 'status', 'position', 'section', etc.

In the frontend I check for widgets for a particular section and just run a foreach loop in the different template positions.

Hope this helps...it works for me!

Thanks Wiredesignz
#4

[eluser]Davcon[/eluser]
Thanks for that. He does build exceedingly good things.
#5

[eluser]kerell78us[/eluser]
No problem buddy...

Indeed he does!




Theme © iAndrew 2016 - Forum software by © MyBB