Welcome Guest, Not a member yet? Register   Sign In
role based menu include
#2

[eluser]PhilTem[/eluser]
I'd create a library called "Navigation" that has some method called maybe "render" which you can also call via a helper "navigation_render()" so that your view only has the line

Code:
echo navigation_render();

while the helper does something like

Code:
function navigation_render()
{
  static $CI;
  isset($CI) OR $CI =& get_instance();
  
  isset($CI->navigation) OR $CI->load->library('navigation');
  
  return $CI->navigation->render();
}

What your method render of class navigation does should be up to you, but it will basically grab the allowed/viewable items of the menu and pass those to a view that will properly format the array to e.g. an UL or OL.

Besides: You might want to consider using a templating library because it'll keep your code from getting wet plus it just is nicer to have a wrapper around some content rather than pre-content, content and post-content parts, IMHO Wink


Messages In This Thread
role based menu include - by El Forum - 11-15-2012, 09:25 AM
role based menu include - by El Forum - 11-15-2012, 10:48 AM
role based menu include - by El Forum - 11-15-2012, 11:54 AM
role based menu include - by El Forum - 11-16-2012, 01:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB