Topic: How to load data for footer and other common blocks on site?
I write Django application, but asking here, because RoR have reputation of the etalon MVC framework.
Many pages on my site have common blocks: footer, sidebar, userblock.
Some of them (sidebar for instance) depends on the page being displayed.
I use inclusion (and inheritence) of templates to avoid html code duplication,
but how do i load data for sub-templates ?
I see three solutions:
1) Load data directly from sub-templates, inserting code there. It simple, but make templates *active*.
2) Write helper functions, such as *load_data_for_footer*, and call them from each controller.
3) Use some kind of controller hierarchy. May be inheritence. So root controller will load data for footer,
and each its child will get this data in context automaticaly. But Django lacks of such features =(
What is the best solution from RoR's point of view ?
Thank you and sorry for my poor english.
Last edited by mialinx (2011-10-06 02:55:27)