... | ... |
@@ -16,13 +16,23 @@ class Vue{ |
16 | 16 |
|
17 | 17 |
ob_start(); |
18 | 18 |
require CONTROLLER_PATH.DIRECTORY_SEPARATOR.$name.'.php'; |
19 |
- require VIEW_PATH.DIRECTORY_SEPARATOR.$name.'.phtml'; |
|
20 |
- $this->block_body = ob_get_clean(); |
|
19 |
+ $loader = new \Twig\Loader\FilesystemLoader(VIEW_PATH); |
|
20 |
+ $twig = new \Twig\Environment($loader, array( |
|
21 |
+ 'cache' => INCLUDE_PATH.DIRECTORY_SEPARATOR.'cache', |
|
22 |
+ 'auto_reload' => true, |
|
23 |
+ 'autoescape' => true |
|
24 |
+ )); |
|
25 |
+ $template = $twig->load("$name.html.twig"); |
|
26 |
+ $twig_var['page_title'] = $page_title; |
|
27 |
+ $twig_var['description'] = $description; |
|
21 | 28 |
|
22 |
- ob_start(); |
|
23 |
- require LAYOUT_PATH.DIRECTORY_SEPARATOR."standard.phtml"; |
|
29 |
+ echo $template->render($twig_var); |
|
24 | 30 |
$this->ecran = ob_get_clean(); |
25 | 31 |
|
32 |
+ /*ob_start(); |
|
33 |
+ require LAYOUT_PATH.DIRECTORY_SEPARATOR."standard.phtml"; |
|
34 |
+ $this->ecran = ob_get_clean();*/ |
|
35 |
+ |
|
26 | 36 |
} |
27 | 37 |
|
28 | 38 |
} |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,28 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+namespace MVC\Classe; |
|
4 |
+ |
|
5 |
+define( "LAYOUT_PATH" , APPLICATION_PATH . DIRECTORY_SEPARATOR . "layout"); |
|
6 |
+ |
|
7 |
+ |
|
8 |
+class Vue{ |
|
9 |
+ |
|
10 |
+ public $ecran; |
|
11 |
+ public $block_body; |
|
12 |
+ |
|
13 |
+ public function __construct($baseControlleur){ |
|
14 |
+ |
|
15 |
+ extract( $baseControlleur->modele->page ); |
|
16 |
+ |
|
17 |
+ ob_start(); |
|
18 |
+ require CONTROLLER_PATH.DIRECTORY_SEPARATOR.$name.'.php'; |
|
19 |
+ require VIEW_PATH.DIRECTORY_SEPARATOR.$name.'.phtml'; |
|
20 |
+ $this->block_body = ob_get_clean(); |
|
21 |
+ |
|
22 |
+ ob_start(); |
|
23 |
+ require LAYOUT_PATH.DIRECTORY_SEPARATOR."standard.phtml"; |
|
24 |
+ $this->ecran = ob_get_clean(); |
|
25 |
+ |
|
26 |
+ } |
|
27 |
+ |
|
28 |
+} |