Welcome Guest, Not a member yet? Register   Sign In
how to use model?
#5

[eluser]Frank Berger[/eluser]
[quote author="syntaxerror" date="1223894528"]thanks guys, but that too technical, i mean technical terms.
how can i call model in the controller and how can i call controller in a model?

thanks[/quote]

Uhm.. well.. this is a rather technical topic, but on calling a model from the controller:

Code:
class myController Extends Controller {

function myController() {
  parent::Controller();
  $this->load->model('myModel');
}

function index() {
  $data = $this->mymodel->getdata();
}

}

as on calling a Controller from a Model, that is not really an advisable Procedure, as usually only the browser/user interacts with the controller, but something like this:

Code:
$CL = &get;_instance();

will get you the currently loaded Controller object referenced in your library or model code, and you can access the Controllers methods.

you really should read and understand the documentation on this from here:
http://ellislab.com/codeigniter/user-gui...odels.html

Frank


Messages In This Thread
how to use model? - by El Forum - 10-12-2008, 09:14 PM
how to use model? - by El Forum - 10-12-2008, 10:41 PM
how to use model? - by El Forum - 10-12-2008, 10:55 PM
how to use model? - by El Forum - 10-12-2008, 11:42 PM
how to use model? - by El Forum - 10-12-2008, 11:54 PM
how to use model? - by El Forum - 10-13-2008, 12:06 AM
how to use model? - by El Forum - 10-13-2008, 12:51 AM
how to use model? - by El Forum - 10-13-2008, 01:05 AM
how to use model? - by El Forum - 10-13-2008, 01:20 AM
how to use model? - by El Forum - 10-13-2008, 01:28 AM
how to use model? - by El Forum - 10-13-2008, 02:10 AM
how to use model? - by El Forum - 10-13-2008, 02:43 AM
how to use model? - by El Forum - 10-13-2008, 02:53 AM
how to use model? - by El Forum - 10-13-2008, 02:59 AM
how to use model? - by El Forum - 10-13-2008, 03:04 AM
how to use model? - by El Forum - 10-13-2008, 03:08 AM
how to use model? - by El Forum - 10-13-2008, 03:17 AM
how to use model? - by El Forum - 10-13-2008, 03:34 AM
how to use model? - by El Forum - 10-13-2008, 03:43 AM
how to use model? - by El Forum - 10-13-2008, 03:49 AM
how to use model? - by El Forum - 10-13-2008, 03:54 AM
how to use model? - by El Forum - 10-13-2008, 03:55 AM
how to use model? - by El Forum - 10-13-2008, 03:59 AM



Theme © iAndrew 2016 - Forum software by © MyBB