Welcome Guest, Not a member yet? Register   Sign In
How to set tree view in dynamic menu in codeigniter
#1

(This post was last modified: 08-03-2018, 09:33 PM by jaydevvara.)

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 CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

(08-07-2018, 09: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 CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB