Welcome Guest, Not a member yet? Register   Sign In
An easy way to execute a method from the view ..
#5

[eluser]srobet[/eluser]
This function i use now into my library for top menu:
Code:
function top_menu()

    {

        $CI =& get_instance();

        $CI->db->order_by('page_order');

        $querytop=$CI->db->get_where('page',array('publish'=>1,'top_page'=>0,'position_id'=>0));

        $top_page='';

        $top_page.='<li>'.anchor('','Home').'</li>';

        foreach($querytop->result() as $rowstop)

        {

            $CI->db->order_by('page_order');

            $querysub=$CI->db->get_where('page',array('publish'=>1,'top_page'=>$rowstop->page_id));

            $totalsub=$querysub->num_rows;

            if($totalsub==0)

                $top_page.='<li>'.anchor($rowstop->slug,$rowstop->menu_display).'</li>';

            else

            {

                $top_page.='<li>'.anchor($rowstop->slug,$rowstop->menu_display,array('class'=>'MenuBarItemSubmenu'));

                $top_page.='<ul>';

                foreach($querysub->result() as $rowsub)

                {

                    $top_page.='<li>'.anchor($rowsub->slug,$rowsub->menu_display).'</li>';    

                }

                $top_page.='</ul></li>';

            }

        }

        return $top_page;

    }

This function support 2 level submenu


Messages In This Thread
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 05:33 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 05:45 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 05:55 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 06:00 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 06:05 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 06:16 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 06:26 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 06:40 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 06:50 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 06:58 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 07:19 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 07:24 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 07:35 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 07:39 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 07:44 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 07:54 AM
An easy way to execute a method from the view .. - by El Forum - 07-31-2008, 08:08 AM



Theme © iAndrew 2016 - Forum software by © MyBB