Welcome Guest, Not a member yet? Register   Sign In
So I'm trying 100% to use MVC...
#6

[eluser]obiron2[/eluser]
MVC pattern explained for above scenario

Your list of links is a 'dynamic' element and may change on a different web site or in the future - or you may want to have different menu options on different pages.

Your links data should go in a model
Your controller should ask the model for a list of links
Your view should render the links as is seen fit.

Now your model could just store your links in an array and return the array, or it could read a text file or it could get the information from a database.

The beauty of MVC is that the controller doesn't care how the model gets it's data and doesn't have to worry about what the page looks like.

Implementing the above, you have a 'generic' process for building your menus. Adding a new option to the menu for each page could be as simple as adding a record to a database table.

All the business logic happens in the controller
All the user rendering happens in the view
All the data access happens in the model.

Obiron


Messages In This Thread
So I'm trying 100% to use MVC... - by El Forum - 02-10-2009, 09:13 PM
So I'm trying 100% to use MVC... - by El Forum - 02-10-2009, 11:30 PM
So I'm trying 100% to use MVC... - by El Forum - 02-11-2009, 02:19 AM
So I'm trying 100% to use MVC... - by El Forum - 02-11-2009, 02:25 AM
So I'm trying 100% to use MVC... - by El Forum - 02-11-2009, 03:30 AM
So I'm trying 100% to use MVC... - by El Forum - 02-11-2009, 07:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB