Hi there !

The code(in model) given below generates the list structure:

function getNavigation($parent_id = 0, $show_product = 0, $flg = 0 ){
                $query = $this->db->get_where('categories', array('parent_id' => $parent_id));
                //var_dump($query->result()); //exit;

                if($query->num_rows() ){
                    $this->navigation .= '<ul id="browser" class="filetree">';
                    foreach($query->result() as $v){
                        $this->navigation .= '<li> <span class="folder">';

                            if($flg) {

                            if($v->categories_id == $this->config->item('category_search_cid')){ //go to advanced search page
                                $this->navigation .= '<a href="'.site_url( 'category/showCustom/' . $v->categories_id ).'">';
                            }else{
                                //$this->navigation .= '<a href="'.site_url( 'product/prod_details/' . $v->parent_id ."/".$v->categories_id ).'">';
                                $this->navigation .= '<a href="'.site_url( 'product/category/'.$v->categories_id ).'">';
                            }

                            }

                        $this->navigation .= $v->categories_name;

                        if($flg) {
                            $this->navigation .= '</a>';
                        }

                        $this->getNavigation($v->categories_id, $show_product, 1 );
                        //show category product
                        if($show_product){
                            // ----------- Inner Lists Generation---------------
                            $this->navigation .= '<ul>';
                            $products = $this->getProductsByCID($v->categories_id);
                            if($products){
                                foreach($products as $p_v){
                                    $this->navigation .= '<li><span class="file">';
                                    if($p_v->url){
                                        $this->navigation .= '<a href="'.site_url('product/c/'.$p_v->url).'">'.$p_v->p_model.'</a>';
                                    }else{
                                        //$this->navigation .= '<a href="'.site_url('product/detail/'.$p_v->id).'">'.$p_v->p_model.'</a>';
                                        $this->navigation .= '<a href="'.site_url('product/detail/'.$p_v->id).'">'.$p_v->p_name.'</a>';
                                    }
                                    $this->navigation .= '</span></li>';
                                }
                            }
                            $this->navigation .= '</ul>';
                            // -----------Inner Lists Generation Ends---------------
                        }
                        //show category product end
                        $this->navigation .= '</span></li>';
                    }
                    $this->navigation .= '</ul>';


                }
            }

The code below is the view :

<div id="mainleft" class="mcon_left">
    <div  class="pro_nav" >  
    <div id="main">

        <?php echo $nav; ?>

    </div>
    <div class="mailus">
    <a href="mailto:inquiry@k52.com;globalsourcinghk@21cn.net"><img src="./images/mailus_img.png" /></a>
    </div>
    </div>

In header section of the site i included following files :

<!-- Treeview Starts-->
        <link rel="stylesheet" href="<?php  echo base_url();?>css/jquery.treeview.css" />
        <link rel="stylesheet" href="<?php  echo base_url();?>css/screen.css" />

        <script src="<?php  echo base_url();?>js/jquery.js" type="text/javascript"></script>
        <script src="<?php  echo base_url();?>js/jquery.cookie.js" type="text/javascript"></script>
        <script src="<?php  echo base_url();?>js/jquery.treeview.js" type="text/javascript"></script>
<!-- Treeview Ends-->

Please help me to fix it out .. Thanks in advance...

Member Avatar for diafol

You don't mention what the problem is. This would give us a clue as to what we should be looking for.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.