Welcome Guest, Not a member yet? Register   Sign In
load model from own class
#1

[eluser]wiZe[/eluser]
hi there,
i got a problem with loading a model from one of my classes. i created a class:


€dit: ok it is definetly a matter of the class not being able to run the loader class! but it must be really simple, its basicly that:

- create own class in app/libraries
- load an instance of this class in one of my controllers
- load a view/model/whatever from within my own class

Any recommendations?



Code:
<?php
class Sandwhich extends Controller {
    var $id;
    var $Sandwhich;
    
    function Sandwhich ($id)
    {
        $this->build_sandwhich ($id);
    }
    
    function show_sandwhich($id = FALSE)
    {
        $this->load->model('admin/admin_sandwhich _model');
        $poi = $this->admin_sandwhich _model->get_data($id);
    }
}
?>

and instantiated it in my controller:

Code:
<?php
class Controll extends Controller
{
    function show_sandwhich($id = FALSE)
    {
        $this->load->library('Sandwhich', $sandwhich_id);
    }
}
?>

now i recieve this error message:

Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Admin_sandwhich_model::$db

Filename: admin/admin_sandwhich_model.php

Line Number: 11

Fatal error: Call to a member function select() on a non-object in /path/admin_sandwhich_model.php on line 11

how do i load a model from my own class? hope somebody has an answer for me, thanks in advance!


Messages In This Thread
load model from own class - by El Forum - 11-17-2008, 06:42 AM
load model from own class - by El Forum - 11-17-2008, 06:45 AM
load model from own class - by El Forum - 11-17-2008, 06:50 AM
load model from own class - by El Forum - 11-17-2008, 06:56 AM
load model from own class - by El Forum - 11-17-2008, 07:00 AM
load model from own class - by El Forum - 11-17-2008, 07:51 AM
load model from own class - by El Forum - 11-17-2008, 07:52 AM
load model from own class - by El Forum - 11-17-2008, 07:54 AM
load model from own class - by El Forum - 11-17-2008, 09:05 AM
load model from own class - by El Forum - 11-17-2008, 09:17 AM



Theme © iAndrew 2016 - Forum software by © MyBB