Welcome Guest, Not a member yet? Register   Sign In
best practices? db call for every page
#1

[eluser]chrisco23[/eluser]
Hi,

I need to make one db query to populate part of a navigation menu used on every page.

I'd like to not put this in the view file, so currently I have the same 3 lines of code stuck into every controller. I'd like to not have to do this (and not have to remember to do this).

What's a better way?


Thanks,
Chris
#2

[eluser]beemr[/eluser]
This thread covers your topic.
#3

[eluser]Rick Jolly[/eluser]
Yup, that thread outlines 2 good methods of reducing repetition:
1) controller inheritance
2) loading "modules" (view fragments with data) from within the view.
#4

[eluser]chrisco23[/eluser]
Thanks, I like the controller inheritance idea. Haven't really explored the "modules" stuff yet.


Chris




Theme © iAndrew 2016 - Forum software by © MyBB