⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

groceryCRUD on existing view



Funkyz0r
  • profile picture
  • Member

Posted 08 June 2016 - 17:20 PM

Helloy guys! I have a problem with CSS and JS from grocery CRUD. I put the CRUD on an existing view and my navbar is messed up. I have to mention that the CRUD is working perfectly.
 
Like in this picture:
 
I want to make it here:
 
The code for the overview - controller:
 
    <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    
    class Overview extends CI_Controller {
    
     function __construct()
     {
       parent::__construct();
     }
    
     function index()
     {
       if($this->session->userdata('logged_in'))
       {
         $session_data = $this->session->userdata('logged_in');
         $data['email'] = $session_data['email'];
         $this->load->view('overview', $data);
       }
       else
       {
         //If no session, redirect to login page
         redirect('login', 'refresh');
       }
     }
    
     function logout()
     {
       $this->session->unset_userdata('logged_in');
       session_destroy();
       redirect('home', 'refresh');
     }
    
    public function sumar(){
     
    $this->load->library('grocery_CRUD');
    $crud = new grocery_CRUD();
     
    $crud->set_theme('datatables');
     
    $crud->set_table('sumar');
    $crud->set_subject('operatie');
    
    //Required fields for ADD
    $crud->required_fields('data','type','categorie');
    
    //Columns
    $crud->columns('data','type','categorie','descriere','suma');
    $crud->display_as('data','Data')->display_as('type','Tip Operatie')->display_as('categorie','Categorie')->display_as('descriere','Descriere')->display_as('suma','Suma');
    
    //Fields for ADD
    $crud->fields('data','type','categorie','descriere','suma');
    
    //Dropdown, enum etc.
    $crud->field_type('type','enum',array('Expense','Income'));
    $crud->field_type('categorie','enum',array('Food & Dining','Automobile','Bills','Housing', 'Taxes', 'Other', 'Rental', 'Salary', 'Support'));
    
    //Order
    $crud->order_by('data','desc');
    
    //Unset JQuery
    $crud->unset_jquery();
    
    
     $output = $crud->render(); 
    
    $this->_overview_output($output); 
    
    }
    
    
    // function _example_output($output = null)
     
    // {
    // $this->load->view('overview.php',$output);    
    // }
    
    
        function _overview_output($output = null)
    
        {
            $page_title = "Overview";
            $this->load->vars( array( 'page_title' => $page_title) );     // <- This puts $html_title into the context for the view() below
            $this->load->view('overview',$output);
            
            
        }
    
    }
    
    ?>
 
Code for overview - view:
 
     
  
            <!-- Page Content -->
            <div id="page-wrapper">
                <div class="container-fluid">
                    <div class="row">
                        <div class="col-lg-12">
                            <h1 class="page-header">Overview</h1>
    <div>
    <?php foreach($css_files as $file): ?>
        <link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" />
     
    <?php endforeach; ?>
    <?php foreach($js_files as $file): ?>
     
        <script src="<?php echo $file; ?>"></script>
    <?php endforeach; ?>
     
    <style type='text/css'>
    body
    {
        font-family: Arial;
        font-size: 14px;
    }
    a {
        color: blue;
        text-decoration: none;
        font-size: 14px;
    }
    a:hover
    {
        text-decoration: underline;
    }
    </style>
        <?php echo $output; ?>
    </div>      
                        </div>
                    
Thanks!