• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Efficiently re-using code

#1
[eluser]Xandrios[/eluser]
Hello,

I've just started learning CI. Aside from a few strange issues in the Database cache module things are going smooth. Worked successfully through a couple of tutorials as well. So for practice I decided to setup a small CMS-like website. And this is where I ran into problems.

Say I would like all the application pages to look the same (header, menu, side, footer), only the main content changes. And with for example on every page the weekly poll shown on the side.
Building simple pages works very well, but how would I re-use the header/footer code in a smart way? And more importantly: How would I show the Poll on each page on the side? Off course this could be solved by copying the poll-view to the view of every page, but that is ugly at the least. plus that would mean that I need to implement a database call (Got to find the poll question and choices) in each controller to be able to show the poll properly.

Is there a way to somehow create a module (ie a poll) and 'include' this on every page that I would like it to be on? And the same for header/footer data?

Thank you!


Messages In This Thread
Efficiently re-using code - by El Forum - 07-06-2007, 01:45 PM
Efficiently re-using code - by El Forum - 07-06-2007, 02:34 PM
Efficiently re-using code - by El Forum - 07-06-2007, 03:08 PM
Efficiently re-using code - by El Forum - 07-06-2007, 07:12 PM
Efficiently re-using code - by El Forum - 07-06-2007, 07:25 PM
Efficiently re-using code - by El Forum - 07-07-2007, 05:50 AM
Efficiently re-using code - by El Forum - 07-07-2007, 06:23 PM
Efficiently re-using code - by El Forum - 07-08-2007, 10:28 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.