• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fatal error: Call to a member function set_template() on a non-object

#1
[eluser]skylerrichter[/eluser]
I have a weird issue occurring with the HTML table class when I extends models. I found one other thread with a similar issue but it doesn't seem to be the same issue all together http://ellislab.com/forums/viewthread/78244/

The dashboard controller extends the private controller which is just an extension of the default controller with some user authentication.

I load the comments model.

Get a result set of comments.

and load a view file.

here is what my view file looks like:

Code:
&lt;?php $this->table->set_template(array('table_open' => '<table border="0" cellpadding="0" cellspacing="0" width="100%">', 'row_alt_start' => '<tr class="alt">')); ?&gt;
    &lt;?php echo $this->table->generate(); ?&gt;
    ect..
    &lt;?php $this->pagination->create_links(); ?&gt;

here is what my controller looks like:

Code:
class Dashboard extends Private_Controller
    {
        function index()
        {
            $this->load->model('comments');
            
            $data['comments'] = $this->comments->all(array('limit' => 5));
            
            $this->load->template('dashboard/index', $data);
        }
    }

If I remove this line from my view

Code:
&lt;?php $this->table->set_template(array('table_open' => '<table border="0" cellpadding="0" cellspacing="0" width="100%">', 'row_alt_start' => '<tr class="alt">')); ?&gt;
    &lt;?php echo $this->table->generate(); ?&gt;

everything works... including the codeigniter pagination class that is in the same view.

How come the HTML table class stops working but the pagination class doesnt?

Note: both the table class and pagination classes are loaded in the autoload config

#2
[eluser]pistolPete[/eluser]
Did you load the library?
Code:
$this->load->library('table');

#3
[eluser]skylerrichter[/eluser]
Yes i tried loading the libraries manually too.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.