Skip to content

Instantly share code, notes, and snippets.

@fieldju
Created May 11, 2012 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fieldju/2663149 to your computer and use it in GitHub Desktop.
Save fieldju/2663149 to your computer and use it in GitHub Desktop.
multiple datagrids with grocery CRUD using IFRAMES
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Controller extends Application{
private static $data = array();
public function __construct(){
parent::__construct();
/* restrict access to all but admin */
$this->ag_auth->restrict('admin');
// load database
$this->load->database();
/* Load helpers */
$this->load->helper(array('url', 'form', 'registration', 'menu', 'language'));
/* Load libraries */
$this->load->library('grocery_CRUD');
/* setup default view data */
$this->data['title'] = 'Admin Dashboard';
$this->data['MenuItems'] = get_menu_items('admin');
}
public function index(){
if(logged_in()){
//* load views */
$this->load->view('templates/header', $this->data);
$this->load->view('dashboard');
$this->load->view('templates/footer');
}
else{
$this->login();
}
}
function grid1(){
$this->grocery_crud->set_table('WaitlistForm');
$output = $this->grocery_crud->render();
$this->load->view('grid',$output);
}
function grid2(){
$this->grocery_crud->set_table('users');
$output = $this->grocery_crud->render();
$this->load->view('grid',$output);
}
}
<IFRAME SRC=<?php echo base_url('controller/grid1');?> WIDTH=1200 Height=500></IFRAME>
</br>
<IFRAME SRC=<?php echo base_url('controller/grid2');?> WIDTH=1200 Height=500></IFRAME>
<?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; ?>
<div id="content">
<?php echo $output; ?>
</div>
@fieldju
Copy link
Author

fieldju commented May 12, 2012

If your wondering why the controller extends Application that is because i am using ag_auth in my codeigniter project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment