• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Loader isnt loading -.-

#1
[eluser]nagata[/eluser]
Could someone help with this
Code:
<?php
$this->load->model('auth_model');
$ident=$this->session->userdata('ident');
if ($this->session->userdata('logged_in')==true) {
$this->auth_model->i_am_on($ident[1]['id']);}
?>
Its located in file views/templates/prefab.php
Its small php code that determines user is online currently.
it was working when it was in views/auth/index.php (User List)
But stoped working in other documents... I tried to place it EVERYWHERE, but sadly there was no result for it to work excep this error
Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Loader::$auth_model

Filename: templates/prefab.php

Line Number: 5


Fatal error: Call to a member function i_am_on() on a non-object in C:\xampp\htdocs\application\views\templates\prefab.php on line 5

could someone explain me this black CI humor and make it work? I been trying to make it work like 2 hours now -.-


the i_am_on() function
Code:
public function i_am_on($id)
{
if ($this->session->userdata('logged_in')==true){
$data = array('lastseen' => time(),);
$this->db->where('id', $id);
$this->db->update('users', $data);
}
}

#2
[eluser]Samus[/eluser]
You need to seriously go read the CI user guide and understand it.

Loading in a view? Seriously?

Start here: http://ellislab.com/codeigniter/user-gui...w/mvc.html
Then here: http://ellislab.com/codeigniter/user-gui...views.html

#3
[eluser]nagata[/eluser]
your reply sorta helped me to get the idea of adding the auth_model into autoload config...
so yeah thank you.

#4
[eluser]Samus[/eluser]
[quote author="nagata" date="1339239650"]your reply sorta helped me to get the idea of adding the auth_model into autoload config...
so yeah thank you.[/quote]
Glad to help. Smile

But my point was that you should be loading from within your controller.

#5
[eluser]nagata[/eluser]
I had it loading in controller didnt help either... anyways solved/should be closed.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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