• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to set tree view in dynamic menu in codeigniter

#1
Hello guyyz i need help in design,i don't have ideas about design, i have created dynamic menu in codeigniter i want to set that menu in treeview. First click on parent menu after open child menus, so how to implement it help me

Here is My View Code:

  <?php
                                        foreach ($test as $val) {
                                            $array = explode(",", $val->category_id);
                                        }

                                        foreach ($get_cat as $key => $value) {

                                            if (in_array($value->category_id, $array)) {
                                                echo $value->category_name . '&nbsp;&nbsp;'; //Here my menu print
                                            }
                                        }
             ?>
Reply

#2
Do you mean set the active state or some thing else?
What did you Try? What did you Get? What did you Expect?

Joined the CodeIgniter Community in 2009.          ( Skype: insitfx )
Reply

#3
(08-07-2018, 10:00 AM)InsiteFX Wrote: Do you mean set the active state or some thing else?

yes active state and parent menu,child menu
Reply

#4
You can try this, I created it a while back so hope it still works. No time to test right now.

PHP Code:
/**
 * active_link ()
 * ------------------------------------------------------------------------
 *
 * Sets the active links
 *
 * Usage HTML Code:
 *
 *  You need to tell it the page name.
 *
 * <li <?php echo active_link('Welcome');?>>
 *
 * @access    public
 * @param    string
 * @return    string
 */
if ( ! function_exists('active_link'))
{
    function 
active_link($controller)
    {
        
$_ci =& get_instance();

        
$class $_ci->router->fetch_class();

        return (
$class == $controller) ? ' class="active"' '';
    }


Hope it helps.
What did you Try? What did you Get? What did you Expect?

Joined the CodeIgniter Community in 2009.          ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


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