Categories listing menu in footer |
Hello
I 'm a beginner with CI so please excuse my lack of knowledge ![]() I'm having the same Header & Footer accross my whole website, and I would like to have a blog categories listing menu in my footer (these blog categories are stored in database) I'm using renderSection in this view/layout file to call each different body of website. But I don't know how to code my categories listing function so that it's run in the footer accross all pages and controllers. Doing this in the view is bad practice, but I'm lost. Thank you for your help !
You could do this several ways.
I'd suggest creating a filter that is run before your controller(s). In your filter, you'd pull from the db the blog categories. You can then define a constant with an array of your blog categories. Then in your footer you canĀ iterate over the blog category array as required. CI Filter reference: https://codeigniter.com/user_guide/incom...lters.html |
Welcome Guest, Not a member yet? Register Sign In |