1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,26 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+namespace MVC\Classe; |
|
4 |
+ |
|
5 |
+class Modele{ |
|
6 |
+ |
|
7 |
+ public $page; |
|
8 |
+ |
|
9 |
+ public function __construct($base_param){ |
|
10 |
+ |
|
11 |
+ if(file_exists(MODELS_PATH.DIRECTORY_SEPARATOR.$base_param['name'].'.model')){ |
|
12 |
+ $fichier = file(MODELS_PATH.DIRECTORY_SEPARATOR.$base_param['name'].'.model'); |
|
13 |
+ foreach ($fichier as $ligne_num => $ligne) { |
|
14 |
+ if (preg_match("#[ ]*([a-zA-Z-_+]*)[ ]*[:][ ]*([a-zA-Z-_+ ']*[ ]*)#", $ligne, $matches)) { |
|
15 |
+ $this->page[$matches[1]] = $matches[2]; |
|
16 |
+ } |
|
17 |
+ } |
|
18 |
+ $this->page['url_params'] = $base_param['params']; |
|
19 |
+ }else{ |
|
20 |
+ $this->page['name'] = $base_param['name']; |
|
21 |
+ $this->page['description'] = $base_param['description']; |
|
22 |
+ $this->page['params'] = $base_param['params']; |
|
23 |
+ } |
|
24 |
+ } |
|
25 |
+ |
|
26 |
+} |