Guest User

Untitled

a guest
Jan 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.25 KB | None | 0 0
  1. FIRST, the error "Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 32 bytes) in ....." is caused by parent::__construct()
  2. I do parent::__construct() because I want the Controllers to have access to the Models, and with parent::__construct() you could do that, without doing
  3. something like global $myController;, I guess you could also do myController::function, but I don't know.
  4.  
  5. Another thing that could be done is not load the classes on __construct(), but do some functions in the Bootstrap suchas as loadModel(), which would load
  6. the Model class and all the Models, and use that function when we need to use the model(always in controller)
  7.  
  8. Example of that:
  9.  
  10. Class U_Controlller
  11. {
  12. public function login()
  13. {
  14.  $model = $this->loadModel() //Comes from the bootstrap
  15.  
  16.  if($model->U_Model->nameTaken($_POST['lusername']) == false)
  17.  {
  18.      echo 'Name is not taken!';
  19.  }
  20.  else
  21.  {
  22.      echo 'Name is taken!';
  23.  }
  24. }
  25. }
  26.  
  27.  
  28. Second, I am planning of calling the controller in the template files(.html) like {U_Controller-login}, by making each controller and its function a
  29. template parameter, I do this in Controller.php, only problem is that when I set them as a param it calls the function, instead of calling it when the param
  30. is read. Gotta' find a work-around to this.
  31.  
  32.  
  33. Third, I am planning on doing something like, instead of $_POST['lusername'], do something like $Application->Controller->View->F_View->set();, which would
  34. make  filtered($_POST['lusername']) into $Application->Controller->View->F_View->lusername; that's something I did for RevCMS.
  35.  
  36.  
  37. Fourth, I am using an abstract database layer to handle which engine the CMS is using, I'm planning on implementing SQLite(maybe SQLite3), MySQLi, PDO_MySQL, MySQL,
  38. PostgreSQL and MsSQL, since all these are very similar to MySQL, you could make it so they all use the same functions(connect, disconnect, query, get, clean)
  39. and you could use any of them without having to edit so much, only problem is that some of them use the bind_param function so it requires some parameters in the
  40. query and get(bind_result) function, but that isn't a mayor deal.
  41.  
  42. I don't know of anything else that needs work, at the moment it's rather an awesome but incomplete and needs-work BASE.
Add Comment
Please, Sign In to add comment