Jump to content


bluepicaso

Member Since 19 Mar 2012
Offline Last Active Aug 26 2014 06:14 AM
-----

#836 Loading Custom views and other data

Posted bluepicaso on 19 March 2012 - 09:17 AM

hey I am new here, I have been using codeigniter for a long time and this was my referred to me by a friend.
We Grocery CRUD is just awesome, i came accross a small problem.
i was able to load output from CRUD but there were situationd where i wanted to load a new view.

The obvious solution is to create a new view file.


a small solution from me

The simple example to load extra data as give on the website itself
$crud = new grocery_CRUD();
	  $crud->set_theme('flexigrid');
	  $crud->set_table('scholarship');
	  $crud->set_relation('schCollege', 'university', 'name');
	  $output = $crud->render();
	  $data['title'] = "Manage Scholarship";
	  $output = array_merge($data,(array)$output);
	  $this->_outputData($output);

Loading my custom view
$data['title'] = "Insert via CSV";
	  $data['content'] = 'csvUploader'; // <----------------- the file i need as a view
	  $this->_outputData($data);


My Template
<?php $this->load->view('includes/admin_header');?>
<div id="dataContainer">
  <h2>
	<?=$title?>
  </h2>
  <?php
	if(isset($output))
	{
	  echo $output;
	}
	else
	{
	  $this->load->view($content);
	}
  ?>
</div>
<?php $this->load->view('includes/admin_footer');?>


Hope it helps

Thank you