Welcome Guest, Not a member yet? Register   Sign In
Probably a php-related question..
#9

[eluser]stormbytes[/eluser]
Man.. I'm still missing something - I just don't get the mechanics of this, and so I'm playing guessing games.

Here it is in actual context:

I've got a Model called "Assets_mod". I'd like to assign Catalog_mod to the 'catalog' property of Assets_mod.

So.. Here's Assets_mod:


Code:
if (! defined('BASEPATH')) exit('No direct script access');

include APPPATH. 'models/catalog_mod.php';

class Assets_mod extends Model {
    
    public $catalog;

    function __construct() {
        parent::Model();
    }
    
    function catalog() {
    
      $catalog =& get_instance();
      $catalog->load->model('catalog_mod');
      
      return $catalog = new Catalog();
    }

}

Then, here's my Catalog_mod:

Code:
if (!defined('BASEPATH')) exit('No direct script access');

class Catalog_mod extends Model {

    function __construct() {
        parent::Model();
    }
    
    function test() {
      echo "It works! - The catalog generated this!";
    }

}

And in my controller, I'm trying to call the 'Catalog' method of the Assets model like so:
Code:
$data['catalog']        = $this->assets_mod->catalog->test();

I'm getting errors all around so obviously I'm just not grasping the principle of what's happening here.

Sad


Messages In This Thread
Probably a php-related question.. - by El Forum - 10-19-2010, 09:37 AM
Probably a php-related question.. - by El Forum - 10-19-2010, 10:46 AM
Probably a php-related question.. - by El Forum - 10-19-2010, 10:57 AM
Probably a php-related question.. - by El Forum - 10-19-2010, 11:19 AM
Probably a php-related question.. - by El Forum - 10-19-2010, 11:25 AM
Probably a php-related question.. - by El Forum - 10-19-2010, 11:46 AM
Probably a php-related question.. - by El Forum - 10-19-2010, 01:20 PM
Probably a php-related question.. - by El Forum - 10-19-2010, 05:01 PM
Probably a php-related question.. - by El Forum - 10-20-2010, 10:48 AM
Probably a php-related question.. - by El Forum - 10-20-2010, 11:45 AM
Probably a php-related question.. - by El Forum - 10-20-2010, 01:20 PM
Probably a php-related question.. - by El Forum - 10-20-2010, 01:25 PM
Probably a php-related question.. - by El Forum - 10-20-2010, 01:29 PM



Theme © iAndrew 2016 - Forum software by © MyBB