Vous êtes connecté en tant que anonymous Se Deconnecter
Browse code

Initialisation de l'application modulaire Symfony43 sans systeme de template maitre

Emmanuel ROY authored on 09/08/2019 09:25:45
Showing 15 changed files
... ...
@@ -11,7 +11,7 @@ class Modele{
11 11
 		if(file_exists(MODELS_PATH.DIRECTORY_SEPARATOR.$base_param['name'].'.model')){
12 12
 			$fichier = file(MODELS_PATH.DIRECTORY_SEPARATOR.$base_param['name'].'.model');
13 13
 			foreach ($fichier as $ligne_num => $ligne) {
14
-                if (preg_match("#[ ]*([a-zA-Z-_+]*)[ ]*[:][ ]*([a-zA-Z-_+ ']*[ ]*)#", $ligne, $matches)) {
14
+                if (preg_match("#[ ]*([a-zA-Z-_+]*)[ ]*[:][ ]*([0-9a-zA-Z-_+ ']*[ ]*)#", $ligne, $matches)) {
15 15
                     $this->page[$matches[1]] = $matches[2];
16 16
                 }
17 17
             }
18 18
new file mode 100644
... ...
@@ -0,0 +1,20 @@
1
+<?php
2
+
3
+namespace MVC\Classe;
4
+
5
+class Modular{
6
+
7
+    private $app = "";
8
+
9
+    public function  __construct($appName){
10
+        $this->app = $appName;
11
+    }
12
+
13
+    public function getAppName(){
14
+        return $this->app;
15
+    }
16
+
17
+    public function load(){
18
+        require MODULES_PATH . DIRECTORY_SEPARATOR . $this->getAppName() . DIRECTORY_SEPARATOR . "public" . DIRECTORY_SEPARATOR . "index.php";
19
+    }
20
+}
0 21
\ No newline at end of file
1 22
deleted file mode 100644
... ...
@@ -1,9 +0,0 @@
1
-<?php
2
-
3
-namespace MVC\Classe;
4
-
5
-class ModularApp{
6
-    public static function load($name){
7
-        require MODULES_PATH . DIRECTORY_SEPARATOR . "setup" . DIRECTORY_SEPARATOR . $name . ".twig.class.php";
8
-    }
9
-}
10 0
\ No newline at end of file
... ...
@@ -11,11 +11,25 @@ class Vue{
11 11
 	public $block_body;
12 12
 	
13 13
 	public function __construct($baseControlleur){
14
-		
14
+
15
+        $templateData = array();
15 16
 		extract( $baseControlleur->modele->page );
16 17
 
18
+		print_r($name);
19
+
17 20
 		ob_start();
18 21
         require CONTROLLER_PATH.DIRECTORY_SEPARATOR.$name.'.php';
22
+
23
+        /*$paths = new \SplPriorityQueue;
24
+
25
+        $paths->insert(VIEW_PATH.DIRECTORY_SEPARATOR."system", 100);
26
+        $paths->insert(VIEW_PATH.DIRECTORY_SEPARATOR."templating", 200);
27
+        //$paths->insert('path/to/theme', 300);
28
+
29
+        $renderer = new \Windwalker\Renderer\BladeRenderer($paths, array('cache_path' => VIEW_PATH.DIRECTORY_SEPARATOR."/cache"));
30
+
31
+        $renderer->render( $name , $templateData);
32
+        */
19 33
         require VIEW_PATH.DIRECTORY_SEPARATOR.$name.'.phtml';
20 34
 		$this->block_body = ob_get_clean();
21 35
 
... ...
@@ -0,0 +1,2 @@
1
+<?php
2
+$templateData = array("templating_a"=>'blade',"templating_b"=>'twig',"templating_c"=>'edge');
0 3
\ No newline at end of file
1 4
new file mode 100644
... ...
@@ -0,0 +1,3 @@
1
+<?php
2
+session_start();
3
+$app = new MVC\Classe\Modular($name);
0 4
\ No newline at end of file
1 5
new file mode 100644
... ...
@@ -0,0 +1,5 @@
1
+name : syf43
2
+page_title : Accueil de l'application modulaire
3
+description : zatou stra bracadabla
4
+params : params
5
+
... ...
@@ -1 +1,11 @@
1
-<h1>ERREUR poo_v1</h1><?php /**PATH D:\Dépots Git\MVC---Objet\application\include\vues\templating/error.blade.php ENDPATH**/ ?>
2 1
\ No newline at end of file
2
+<html>
3
+<head>
4
+    <title>App Name</title>
5
+</head>
6
+<body>
7
+
8
+<div class="container">
9
+    ERROR
10
+</div>
11
+</body>
12
+</html><?php /**PATH D:\Dépots Git\MVC---Objet\application\include\vues\templating/error.blade.php ENDPATH**/ ?>
3 13
\ No newline at end of file
4 14
new file mode 100644
... ...
@@ -0,0 +1 @@
1
+<?php $app->load(); ?>
0 2
\ No newline at end of file
... ...
@@ -0,0 +1,14 @@
1
+<html>
2
+<head>
3
+    <title>App Name</title>
4
+</head>
5
+<body>
6
+@section('sidebar')
7
+    This is the master sidebar.
8
+@show
9
+
10
+<div class="container">
11
+    @yield('content')
12
+</div>
13
+</body>
14
+</html>
0 15
\ No newline at end of file
... ...
@@ -0,0 +1,15 @@
1
+@extends('layout.app')
2
+
3
+@section('sidebar')
4
+    @parent
5
+
6
+    <p>This is appended to the master sidebar.</p>
7
+@endsection
8
+
9
+@section('content')
10
+    <h1>Accueil</h1>
11
+    <br /><br /><br />
12
+    {{templating_a}}::{{templating_b}}::{{templating_c}}
13
+
14
+@endsection
15
+
... ...
@@ -0,0 +1,11 @@
1
+<html>
2
+<head>
3
+    <title>App Name</title>
4
+</head>
5
+<body>
6
+
7
+<div class="container">
8
+    ERROR
9
+</div>
10
+</body>
11
+</html>
0 12
\ No newline at end of file
... ...
@@ -14,4 +14,8 @@ class Syf43 {
14 14
         $modularApp = ob_get_clean();
15 15
         echo $modularApp;
16 16
     }
17
+
18
+    public static function twigLoader($name){
19
+        require MODULES_PATH . DIRECTORY_SEPARATOR . "setup" . DIRECTORY_SEPARATOR . $name . ".twig.class.php";
20
+    }
17 21
 }
18 22
\ No newline at end of file
... ...
@@ -4,5 +4,41 @@
4 4
             "MVC\\Classe\\":"./application/class",
5 5
             "MVC\\Objets\\":"./application/objets"
6 6
         }
7
+    },
8
+    "require": {
9
+
10
+        "php": "^7.1.3",
11
+        "windwalker/renderer": "~3.0",
12
+        "illuminate/view": "5.*",
13
+        "ext-ctype": "*",
14
+        "ext-iconv": "*",
15
+        "sensio/framework-extra-bundle": "^5.4",
16
+        "symfony/cache",
17
+        "symfony/cache-contracts",
18
+        "symfony/config",
19
+        "symfony/console": "4.3.*",
20
+        "symfony/debug",
21
+        "symfony/dependency-injection",
22
+        "symfony/dotenv": "4.3.*",
23
+        "symfony/event-dispacher",
24
+        "symfony/event-dispacher-contracts",
25
+        "symfony/filesytem",
26
+        "symfony/finder",
27
+        "symfony/flex": "^1.3.1",
28
+        "symfony/framework-bundle": "4.3.*",
29
+        "symfony/http-foundation",
30
+        "symfony/http-kernel",
31
+        "symfony/mime",
32
+        "symfony/polyfill-intl-idn",
33
+        "symfony/polyfill-mbstring",
34
+        "symfony/polyfill-php72",
35
+        "symfony/polyfill-php73",
36
+        "symfony/routing",
37
+        "symfony/service-contracts",
38
+        "symfony/translation-contracts",
39
+        "symfony/twig-bridge",
40
+        "symfony/twig-bundle": "4.3.*",
41
+        "symfony/var-exporter",
42
+        "symfony/yaml": "4.3.*"
7 43
     }
8 44
 }
... ...
@@ -5,8 +5,8 @@ ini_set('display_errors', 1);
5 5
 
6 6
 define("APPLICATION_PATH", dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR."application");
7 7
 define("VENDOR_PATH", dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR."vendor");
8
+define("MODULES_PATH", APPLICATION_PATH.DIRECTORY_SEPARATOR."modules");
8 9
 
9
-//require APPLICATION_PATH.DIRECTORY_SEPARATOR."autoloader.php";
10 10
 require VENDOR_PATH.DIRECTORY_SEPARATOR."autoload.php";
11 11
 
12 12
 $poo_v1 = new \MVC\Classe\Application();