![]() |
A Question About Creating Libraries - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: A Question About Creating Libraries (/showthread.php?tid=34328) |
A Question About Creating Libraries - El Forum - 09-26-2010 [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? A Question About Creating Libraries - El Forum - 09-26-2010 [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. |