⚠ 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

Loading JS and CSS in general page



berik

berik
  • profile picture
  • Member

Posted 09 June 2020 - 11:00 AM

Below error is given with my script, see below. How do I get the JS and CSS from Grocery crud to be included? 
 
A PHP Error was encountered
Severity: Warning
 
Message: Invalid argument supplied for foreach()
 
Filename: views/example.php
 
Line Number: 8
 
Backtrace:
 
File: /var/www/html/crud/application/views/example.php
Line: 8
Function: _error_handler
 
File: /var/www/html/crud/application/controllers/example.php
Line: 17
Function: view
 
File: /var/www/html/crud/application/controllers/example.php
Line: 91
Function: _example_output
 
File: /var/www/html/crud/index.php
Line: 315
Function: require_once

 

 

This is my code:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
class example extends CI_Controller {
 
public function __construct()
{
parent::__construct();
 
$this->load->database();
$this->load->helper('url');
 
$this->load->library('grocery_CRUD');
}
 
public function _example_output($output = null)
{
$this->load->view('example.php',(array)$output);
}
 
 
 
public function delivery($dl) {
   var_dump($dl); //will output "lang=123"
}
 
 
 
public function artikel($dl = NULL)
{
 
 
if (empty($dl))
{
 
// Connect met MYSQL 
 
 
//$query = $this->db->get('tabAccount');
 
$output = '';
 
//foreach ($query->result() as $row)
// {
    // //$output . = $row->name;
// }
 
 
 
$output .= '
<p>
<form action="">
<div class="form-group">
    <label for="ref">Example select</label>
    <select class="form-control" id="ref">
      <option>2020</option>
      </select>
  </div>
 
 
<div class="form-group">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
 
</form>
</p>';
 
 
//$crud =  new grocery_CRUD();
//$output .= $crud->render();
 
}
 
 
else {
 
 
$crud = new grocery_CRUD();
 
$crud->set_table('Article');
 
$crud->columns(['item','x', 'y', 'z']);
 
                $crud->set_field_upload('file_url','assets/uploads/files');
 
 
$output = $crud->render();
 
 
}
 
$this->_example_output($output);
 
 
}
 
}