CodeIgniter Forums
implementing the third parameter in model class - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: implementing the third parameter in model class (/showthread.php?tid=5716)



implementing the third parameter in model class - El Forum - 02-01-2008

[eluser]diez[/eluser]
in the documentation for the model class it says that you can use a third parameter to configure your database settings.

i was curious if you can use the 3rd parameter to be passed into the current model being instantiated?

for instance:

$this->load->model('Model_name', '', $parameters_for_this_model);


implementing the third parameter in model class - El Forum - 02-01-2008

[eluser]LuckyFella73[/eluser]
Just catch the 3rd parameter, for example:

Code:
$param = $this->uri->segment(3);

and do with $param whatever you want.

In your case:
Code:
$param = $this->uri->segment(3);
$this->load->model(’Model_name’, ‘’, $param);

or shorter:
Code:
$this->load->model(’Model_name’, ‘’, $this->uri->segment(3));