⚠ 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

Problem with Tutorial



JCooper

JCooper
  • profile picture
  • Member

Posted 03 October 2013 - 13:14 PM

Hello, I'm new to Grocery Crud and very excited to use it except that I cannot get it to display. When I run the page I get this error.

 

 The website cannot display the page

 

  Most likely causes:
  • The website is under maintenance.
  • The website has a programming error.

 

 Here is my main.php code

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
class Main extends CI_Controller {
 
    function __construct()
    {
        parent::__construct();
 
        /* Standard Libraries of codeigniter are required */
        $this->load->database();
        $this->load->helper('url');
        /* ------------------ */ 
 
        $this->load->library('grocery_CRUD');
 
    }
 
    public function index()
    {
        $this->_example_output((object)array('output' => '' , 'js_files' => array() , 'css_files' => array()));
    }
 
    public function depunits()
    {
        $this->grocery_crud->set_table('depunits');
        $output = $this->grocery_crud->render();
        $this->load->view('administrator/includes/admin_header', $output);
 
        $this->_example_output($output);        
    }
 
    function _example_output($output = null)
 
    {
        $this->load->view('our_template.php',$output);    
    }
}
 
/* End of file main.php */
/* Location: ./application/controllers/main.php */
 

I am trying to use a pre-made database for the project I am working on.

 

Thanks in advance for your help.


briggers

briggers
  • profile picture
  • Member

Posted 03 October 2013 - 14:22 PM

Hi JCooper

 

There are several things missing from your code. I suggest you look back at the tutorials - maybe even create the table and the controller and try various things with that before working with your own data. It will not take long to get the idea.

 

Good luck


davidoster

davidoster
  • profile picture
  • Member

Posted 11 October 2013 - 04:43 AM

Hello and welcome to the forums [member=jcooper].

Well to be honest the code you have is the absolute minimum as per tutorial, so it should work.

Maybe you need to check again your view file admin_header. Maybe there is something there that causes the problem.

 

Another thing you might want to check as a test is if CodeIgniter in general works and displays the default welcome page before mixing with the Grocery CRUD library.

There might also be something on your web server that causes the problem, so please check this out also.


edramirez

edramirez
  • profile picture
  • Member

Posted 11 November 2013 - 16:15 PM

JCooper -

 

There is something odd about your code. I am wondering why you would do something like this:

 

  1. $this->load->view('administrator/includes/admin_header', $output);
  2. $this->_example_output($output);

 

You copied the example, passing $output to _example_output but you sneaked in a line of code passing $output to admin_header.

 

I think you should eliminate the first line and see if it would work.

 

Regards,

 

Ed Ramirez