Where should I start |
[eluser]nZac[/eluser]
I have been so impressed with CI and it's community support/documentation that I want to move a rather large site over to a MVC style but I do not know where to start. I have about 10 function files that have a bunch of procedure based functions that get called throughout the site. How do I take these files and all the stuff that they do and work them into the MVC. I am a big proponent of learning by doing so if you could, point me in the right direction (such as a book, or another forum post) don't just say do X Y and Z or else I will not learn how to do it in the future Thanks so much for your help!
[eluser]Colin Williams[/eluser]
Why not see how EllisLab is doing it. But honestly, we don't really know where your coming from and where your going. We only now that you have some messy procedural code with a bunch of functions. It's like, "Hey! I've got a bunch of ingredients in my kitchen. How do I make dinner?" So we say, "How about eggs and toast?" only to hear you chime in with, "Well, I don't have any eggs. And I don't want breakfast food." You're unsatisfied, we're frustrated, and nobody's better off. Maybe show us some old code and let's get specific.
[eluser]tonanbarbarian[/eluser]
really you should start be identifying what the site does. Each task/url becomes a method in a controller Then look at your database table, bascially most tables will become a model then look at each model and determine what data you need to processing the model, including fetching data, insert/updating data, deleting data etc. This should give you the basic structure of what controllers you need and what models Anything that is not specific to a controller or model can probably go into libraries Also if you find your controller contain a lot of code then consider either breaking the controller into several sperate controllers, or create a bunch of libraries and move the functions from the controller into the libraries. Lastly you will need to create the view that determine what is displayed You may also need to create some helpers to make it easier to display data in the views. thats a brief run through of what i would do
[eluser]nZac[/eluser]
@Colin Thanks for that I fully understand what you mean, I was really brief and I will remember that for future posts. @tonanbarbarian That is what I was looking for. For example, I have a users table, I need to be able to do 4 things, INSERT, UPDATE, SELECT and DELETE. I should write a function for all for things as a model. Then write a controller to manipulate and then a view to display the results. Right?
|
Welcome Guest, Not a member yet? Register Sign In |