Welcome Guest, Not a member yet? Register   Sign In
How to not repeat code in codeigniter?
#2

[eluser]WanWizard[/eluser]
Use a template library so you can build your page using partials, then use the MY_Controller constructor to generate the 'static' sections of your pages, like headers, footers, sidebar, etc.
If needed, you can use models to fetch information for these sections.

This way your controller method only needs to generate the body section of the template. It keeps your code clean.

You can also use multiple parent controllers. Phil Sturgeon wrote a great article about this.


Messages In This Thread
How to not repeat code in codeigniter? - by El Forum - 09-04-2010, 07:37 AM
How to not repeat code in codeigniter? - by El Forum - 09-04-2010, 10:08 AM
How to not repeat code in codeigniter? - by El Forum - 09-04-2010, 10:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB