I was a flat php programmer for past 2 years. Now I want to move to MVC architecture and so I am using codeigniter which looks very simple to start with. I want to know some of the best practices out there as I go developing in codeigniter.
I have a controller called building, a model called building_data and a view called building_view. Now i want to display list of building by checking lot of conditions. I am doing the following in flat PHP
- Get the list of buildings from database
- Split the result based on certain criteria A, B, C
- Display the result in
section - A,section -B, andsection-cas theHTMLoutput.
Now in MVC I am doing the following
- Get the list of building in the database on
building_data(model) - Store the result from
building_datain a$dataarray of thebuildingcontroller - Split the results based on criteria A,B,C in
building_viewand output theHTML(can i do the condition based classification of data (without using mysql queries) in view ?!My actual question)
Am I doing the right thing here without violating MVC architecture rules ?