Welcome Guest, Not a member yet? Register   Sign In
A Question About Creating Libraries
#1

[eluser]Unknown[/eluser]
I am new to CodeIgniter (and, for the most part, MVC in general) and have a question regarding when to create Libraries and how to create them.

I have a group of features I will be utilizing across several different controllers in my application, specifically creation of a bunch of drop down menus for States, Counties, Cities and Zip Codes. I am also putting some AJAX in to tie all these together. All of this will be pulled from a database.

I know how to create the library, and how to use it. However, I am wondering if it's bad practice to put all the code for this in one Library file (i.e, the database calls, and generation of the HTML). I know that in MVC, it's best practice to put database code into Models, and keep HTML in views. However, I find that to be a bit more than is needed for the purposes of this library. I don't plan on necessarily releasing this library for others to use, just for in house usage.

What would you, as experience CodeIgniter/MVC programmers recommend?
#2

[eluser]Sbioko[/eluser]
Models = interaction with database, Views = Displaying data(HTML), Controllers = Managing all those, Libraries = Some complex or special things, that needs to be organized and clean(for example Twitter API wrapper). This is my opinion.




Theme © iAndrew 2016 - Forum software by © MyBB