Template.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. namespace Manage\Src;
  3. use Dever;
  4. use Dever\Template\View;
  5. use Manage\Src\Lib\Visual;
  6. class Template
  7. {
  8. /**
  9. * project
  10. *
  11. * @var string
  12. */
  13. private $project;
  14. /**
  15. * dir
  16. *
  17. * @var string
  18. */
  19. protected $type;
  20. /**
  21. * config
  22. *
  23. * @var array
  24. */
  25. protected $config;
  26. /**
  27. * __construct
  28. *
  29. * @return mixed
  30. */
  31. public function __construct()
  32. {
  33. $this->project = Dever::input('key');
  34. $this->type = Dever::input('type', 'config');
  35. $config = Dever::load('manage/project.get');
  36. if(isset($config[$this->project]))
  37. {
  38. $this->config = $config[$this->project];
  39. }
  40. }
  41. /**
  42. * index
  43. *
  44. * @return mixed
  45. */
  46. public function index()
  47. {
  48. # 读取当前的service
  49. $view = View::getInstance('home', $this->config['path'], $this->project);
  50. $content = $view->runing();
  51. $config = $view->result();
  52. if(strpos($content, '</body>') >= 0)
  53. {
  54. $content = str_replace('</body>', Visual::tool() . '</body>', $content);
  55. }
  56. else
  57. {
  58. $content = $content . Visual::tool();
  59. }
  60. return $content;
  61. }
  62. }