Welcome Guest, Not a member yet? Register   Sign In
No-CMS, A Free CodeIgniter based CMS to start your project
#10

[eluser]goFrendiAsgard[/eluser]
[quote author="hayer" date="1328200834"]Well, been digging around in the source a bit.. but can't seem to figure this out;

1. How can I share models? Example: 3 controllers all need access to a "user"-model
2. Where/how can new members register?[/quote]

Hi, hayer

1. You can share models just as if you use HMVC. Please take a look at how I call model from different module in tugas_ai module.
Code:
$this->load->model('artificial_intelligence/ai_nnga');
In my tugas_ai controller I load ai_nnga model from artificial_intelligence module.

If that simple step doesn't work for you, you may probably want to use library instead of model. But if you think model is better, I think you should use this approach (which is also used by Ben Edmunds in ion_auth) :
In your modules/your_module_directory/libraries
make a new library (modules/your_module_directory/libraries/your_library), and add __call function
Code:
public function __call($method, $arguments)
{
  $this->ci =& get_instance();
                $this->ci->load->model('your_model');
                if (!method_exists( $this->ci->your_model, $method) )
  {
   throw new Exception('Undefined method your_model::' . $method . '() called');
  }

  return call_user_func_array( array($this->ci->your_model, $method), $arguments);
}

You can then access every function inside your model by using this library. If you want to load the library from other module you can use
Code:
$this->load->library('your_module_directory/your_library');

Let me know if you have problem following those steps.

2. It is a bit odd for me if you can't find register link, just to confirm, can you open this link :
Code:
localhost/No-CMS/index.php/main/register
Is there no "Register" link in the left panel? what version do you use?

However, thank you for your response. It is important for me to know that someone there use my code Big Grin


Messages In This Thread
No-CMS, A Free CodeIgniter based CMS to start your project - by El Forum - 02-02-2012, 08:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB