Advertisement
Guest User

Untitled

a guest
Nov 1st, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. class Controller{
  2.  
  3.  
  4. public function load(){
  5.  
  6. return $this->load;
  7.  
  8. }
  9.  
  10. public function model($name ){
  11.  
  12. require $name;
  13.  
  14. $modname = $name . '_Model';
  15.  
  16. $this->$name = new $modname();
  17.  
  18. }
  19.  
  20.  
  21. }
  22.  
  23. class whatever extends Controller {
  24.  
  25. function __construct() {
  26.  
  27. parent::__construct();
  28.  
  29. $this->model('Login'); //WORK
  30.  
  31. $this->load->model('Login'); //NOT WORK (MY PROBLEM)
  32.  
  33. }
  34.  
  35.  
  36. function Sigin(){
  37.  
  38. $this->Login->anothermodelfunction; //WORK with $this->model('Login')
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement