Welcome Guest, Not a member yet? Register   Sign In
Autoload model with a different object name
#10

[eluser]RJ[/eluser]
Ok. So I can access the model with this:
Code:
$this->dealer->dealer_model($dealer);

Not entirely sure why I need to name the constructor for my dealer_model, but it doesnt work without that.

I can't get my controller to send the URI data to the model; had a similar issue with a library, fixed it, but i decided to use a model rather than a library, back at the same problem.

Controller:
Code:
function Shop()
    {
            parent::Controller();    
            $this->output->enable_profiler(TRUE);    // debug onscreen
            ini_set('display_errors', 1);            // on screen php error display
    }

/*
#--------------------------------------------------------------------------
# METHOD: Device Sub-Controller
#--------------------------------------------------------------------------
|
| http://findwhere.com/s/shop/device
| this is the Method that runs the above URL
*/
    function device($dealer = '999')
    {
        $this->benchmark->mark('code_start');
        // start benchmarking

            $this->dealer->dealer_model($dealer);        // passes db info to dealer library for processing

Dealer_model:
Code:
class Dealer_model extends Model {

    var $dealer    =    "";
    var $vars    =    "";
    
#--------------------------------------------------------------------------
# Controller
#--------------------------------------------------------------------------
    function Dealer_model($dealer)
    {
        // Call the Model constructor
        parent::Model();

        print_r($dealer);
        // submit log entry
        log_message('debug', "Dealer Class Initialized");
        // on screen php error display
        ini_set('display_errors', 1);
        // use dealer var to grab info from db, set $vars
        $this->vars = $this->grab_vars($dealer);
        // add dealer info to session
        $this->session->set_userdata('dealer',$this->vars);        
        // submit log entry
        log_message('debug', "Dealer routines successfully run");
    }


PHP ERRORS:
Code:
list($model, $name, $db_conn) = $babe;
Error:
Quote:Severity: Notice --> Undefined offset: 2 W:\www\s\system\application\libraries\FW_Loader.php 67
there are more, but those should be solved once the passing from controller to model is worked out.


Messages In This Thread
Autoload model with a different object name - by El Forum - 04-07-2009, 07:05 AM
Autoload model with a different object name - by El Forum - 04-07-2009, 08:32 AM
Autoload model with a different object name - by El Forum - 04-07-2009, 08:38 AM
Autoload model with a different object name - by El Forum - 04-07-2009, 08:54 AM
Autoload model with a different object name - by El Forum - 04-07-2009, 08:59 AM
Autoload model with a different object name - by El Forum - 04-07-2009, 09:45 AM
Autoload model with a different object name - by El Forum - 04-07-2009, 09:50 AM
Autoload model with a different object name - by El Forum - 04-07-2009, 09:52 AM
Autoload model with a different object name - by El Forum - 04-07-2009, 10:10 AM
Autoload model with a different object name - by El Forum - 04-07-2009, 10:11 AM
Autoload model with a different object name - by El Forum - 04-07-2009, 10:52 AM
Autoload model with a different object name - by El Forum - 04-07-2009, 11:04 AM
Autoload model with a different object name - by El Forum - 04-07-2009, 11:19 AM
Autoload model with a different object name - by El Forum - 04-07-2009, 12:16 PM
Autoload model with a different object name - by El Forum - 04-07-2009, 12:19 PM
Autoload model with a different object name - by El Forum - 04-07-2009, 12:19 PM
Autoload model with a different object name - by El Forum - 04-07-2009, 12:21 PM
Autoload model with a different object name - by El Forum - 04-07-2009, 12:39 PM
Autoload model with a different object name - by El Forum - 04-07-2009, 12:44 PM
Autoload model with a different object name - by El Forum - 04-07-2009, 12:52 PM
Autoload model with a different object name - by El Forum - 04-07-2009, 01:03 PM



Theme © iAndrew 2016 - Forum software by © MyBB