• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Menu dynamic

#1
Hello, I am developing a sales system using the CodeIgniter 4 framework and I ran into a problem, I need to make the menu build dynamically
 reading from a table the options so far, everything is fine, but at the time of passing it to the view I notice that I must do it from each controller as follows:

return view ('home / index.php', $ options);

But I want to avoid having to do that every time I call the view, that is, is there a way to do the load once in the view and display the menu on the rest of the screens?

I am working with templates so each view extends from a template where I include the different parts.

I thought about doing it using libraries but I didn't know how to load it from the parent template, or create a BaseController subclass and use this subclass and overload it with said functionality but I couldn't either.

I hope you understand what I need.

Thanks
Reply

#2
@mmdp8612,

A suggestion. Maybe generate it once and save it as a session variable Then depending on the page and or access you can determine if you need to regenerate the dynamic menu or keep it as it is.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme ¬© 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.