Guest User

Untitled

a guest
Sep 14th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. Codeigniter template library and HMVC ( mx library ) the static method run()
  2. <?php
  3. class Test extends MX_Controller {
  4.  
  5. public function __construct()
  6. {
  7. parent::__construct();
  8. $this->template->title($this->config->item('site_name','app'));
  9. }
  10.  
  11. public function index()
  12. {
  13. $this->template->build('index');
  14. }
  15. }
  16.  
  17. <?php
  18. //ms module
  19. class Msrofi extends MX_Controller {
  20.  
  21. public function __construct()
  22. {
  23. parent::__construct();
  24. $this->template->title($this->config->item('site_name','app'));
  25. }
  26.  
  27. public function index()
  28. {
  29. $t = Modules::run('test/test/index');
  30. var_dump($t);
  31. $this->template->build('index_message');
  32. }
  33. }
  34.  
  35. class Test extends MX_Controller {
  36.  
  37. public function index()
  38. {
  39. // This path works only from the "test" module
  40. // $this->template->build('index');
  41.  
  42. // This path works from any module
  43. $this->template->build('test/index');
  44. }
  45. }
  46.  
  47. ob_start();
  48. Modules::run('test/test/index');
  49. $t = ob_get_clean();
  50. var_dump($t);
Add Comment
Please, Sign In to add comment