question regarding 2 classes |
[eluser]stitchesinmyhead[/eluser]
hi, i need help. is it possible that i can re-use the function that i already created? the two functions are located in different files. please see my code below. Code: a.php i'm having this error in a.php Severity: Notice Message: Undefined variable: b
[eluser]LuckyFella73[/eluser]
You could extend the base model Code: // MY_model.php Save in application/core (CI 2) or application/libraries (CI < 2.0) There is a nice base model available - provided by Phil Sturgeon: http://bitbucket.org/philsturgeon/codeig...base-model You could place corresponding functions in there. Don't know if that make sense in your project. In your example class b is not in the scope of class a.
[eluser]WanWizard[/eluser]
You can only use 'b' if you load 'b' first, either in the controller that calls 'a', or in 'a' itself before you call 'b'.
[eluser]stitchesinmyhead[/eluser]
thank you sir, but i cant understand the instructions. im a newbie kindly please explain further.
[eluser]atebit[/eluser]
[quote author="stitchesinmyhead" date="1291777258"]thank you sir, but i cant understand the instructions. im a newbie kindly please explain further.[/quote] Prior to accessing "b" you have to load the model.. such as... $this->load->model('Model_name'); Code: a.php
|
Welcome Guest, Not a member yet? Register Sign In |