![]() |
Developing with CI - looking for good practices - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Developing with CI - looking for good practices (/showthread.php?tid=22886) |
Developing with CI - looking for good practices - El Forum - 09-23-2009 [eluser]gfields[/eluser] Hi, I'm pretty new of CI and I'm developing the public part of a CMS based website. I'm looking for good practices to implement a layout based navigation. I've created a new controller (in the library folder) called "MY_controller" that extends Controller with a function get($id) that retrieves all common data about the page (title / mainmenu / language / etc...) In the db every page(with a unique $id) has a layout reference (standard, news, products) that represent what kind of contents needs to be viewed and how. So, I've create a Controller for every layout in the DB (called News, Products, Standard): they extend "MY_controller". Now I'm in this situation: to view a standard page i have this url mysite.com/index.php/standard/get/1 where 1 is the $id of the page. If I want to call the news section I have to write something like this: mysite.com/index.php/news/get/5 where 5 is the $id of the news section (not the single news id) to read a single news i write this: mysite.com/index.php/news/get/5/readnews/1 in the news controller i thake the uri(4) ad call the corresponding function with parameter 1 (uri(5)) Could that be a good way to structure the logic of the website or there are good pratices that I need to learn? What I've done doesn't seem to me really clear coding... Thanx Gfields Developing with CI - looking for good practices - El Forum - 09-23-2009 [eluser]designfellow[/eluser] Hi, Check this page for some tips http://designfellow.com/blog/php-mysql/10-quick-codeigniter-tips-for-better-performance/ Happy Coding, DesignFellow Developing with CI - looking for good practices - El Forum - 09-23-2009 [eluser]gfields[/eluser] Thank you for the tips, very useful. However I'm looking for help on structuring the web site logic. Can the soluntion that I've used be considered a good solution or not? |