0

I currently have a partial called header.php which holds my site navigation among other things. Within this header site navigation is currently hard coded. This hard coded navigation could be set dynamically from the data base however.

My plan is to create a custom helper class, in here will be a function which queries a model and returns the dynamic navigation correctly formatted.

I will then load the helper in my view (header.php), like so:

$this->load->helper('nav helper');

echo all_the_nav();

My question is, is this the correct approach to use in this instance? Information with regards to helper classes is conflicting, some sources state it's not advisable, others state it's fine.

Liam Fell
  • 1,308
  • 3
  • 21
  • 39
  • Nothing bad in that approach. I would advice to load helper in controller or autoload file rather than view. – Tpojka Jan 28 '16 at 19:46
  • another approach is using templates http://stackoverflow.com/questions/34909964/best-way-to-implement-dynamic-menus-headers-footer-using-codeignitor/34911214#34911214 – cartalot Jan 29 '16 at 00:29

0 Answers0