I need to create a multi-level menu system in my layout with data from the database. This data has to be available on every page, where do I make the call to the controller? In a helper?
In rails, there's the application_controller, so there you can put the action you want to get the data from the database for your menu, but for akelos i don't know if page_controller has the same functionality as application_controller in rails.
On EVERY page, or only on pages from a certain model?
What I did for a footer (not data from a database) was to put a footer.tpl inside the "views \ layouts" folder. Then inside each model_name.tpl I inserted
<%= render_partial 'layouts/footer' %>
just under the line:
<?php echo $content_for_layout ?>
Perhaps not the best way to do it, but I couldn't find any documentation on application-wide render_partial's. Perhaps someone with more experiance than I can explain a better (global) way to do a database select and push to each model.
application_controller has the same functionality as application_controller.
but a helper combined with a partial is a good match and easier to test.
1 to 4 of 4