Jump to content


h4kl0rd

Member Since 30 Sep 2013
Offline Last Active Oct 22 2013 09:47 PM
-----

#9714 Using Custom Template

Posted h4kl0rd on 10 October 2013 - 09:19 AM

At last I succeeded in integrating my custom template with Grocery Crud.

 

Here's my implementation:

 

I created a universal view that works for all my output: views >> out.php

In the head of my file, I added the grocery_crud styles and scripts:

<?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; ?>

 

In my Controller, I made the following modifications:

try {
      $crud = new grocery_CRUD();

      $crud->set_theme(...);
      $crud->set_table(...);

      $crud->....

      $output = $crud->render();

      // comment or remove the default grocery_crud output
      //$this->output($output);

      // load your custom view
      $this->load->view('out', $output);
            
 } catch(Exception $e){
      show_error($e->getMessage().' --- '.$e->getTraceAsString());
 }