Signed-off-by: Emmanuel ROY <ornithorynxe@live.fr>
Emmanuel ROY authored on 09/12/2018 04:44:37... | ... |
@@ -1,7 +1,28 @@ |
1 |
-MVC - en Programmation Orienté Objet |
|
1 |
+# MVC - en Programmation Orienté Objet |
|
2 | 2 |
--- |
3 |
-Cette architecture basique est composée d'un layout standard modifiable dont les include sont a définir |
|
4 |
-les urls d'accès sont de type www.domain.tld/page/varname1/varvalue1/varname2/varvalue2/ ... |
|
5 |
-Une page doit etre instanciée dans chacuns des dossiers INCLUDE/modeles-vues-controlleurs de l'application |
|
3 |
+Cette architecture MVC Objet est composée d'un layout HTML5 Standard |
|
6 | 4 |
|
7 |
-pour le reste, c'est a vous de voir, mais c'est une architecture fonctionnelle à 3 vitesses |
|
5 |
+Les urls d'accès sont de type www.domain.tld/page/varname1/varvalue1/varname2/varvalue2/ ... |
|
6 |
+ |
|
7 |
+Afin de créér une nouvelle page vous devez créér trois fichiers contenant divers variables, dont voici les commandes: |
|
8 |
+ |
|
9 |
+ |
|
10 |
+"application > include > controlleurs > mapage.php" contenant: |
|
11 |
+ les commandes permettant de gérer un formulaire |
|
12 |
+ un ou plusieurs accès à la base de données |
|
13 |
+ les variables ainsi instanciées permettent l'affichage dans la vue |
|
14 |
+ |
|
15 |
+"application > include > modeles > mapage.model" contenant |
|
16 |
+les variables spécifiques à la page de l'application exemple: |
|
17 |
+name : le nom de mapage |
|
18 |
+description : ma description pour les moteur de recherche |
|
19 |
+params : paramètre(s) supplémentaire(s) |
|
20 |
+ |
|
21 |
+"application > include > vues > mapage.phtml" contenant |
|
22 |
+les blocs html qui seront afficher dans le layout standard |
|
23 |
+ |
|
24 |
+Je ne peut que vous proposer de regarder dans le dossier layout afin de comprendre comment cela est afficher! |
|
25 |
+ |
|
26 |
+ |
|
27 |
+ |
|
28 |
+pour le reste, c'est a vous de voir, mais c'est une architecture fonctionnelle à 2.5 vitesses |
... | ... |
@@ -6,7 +6,13 @@ class Modele{ |
6 | 6 |
|
7 | 7 |
public function __construct($base_param){ |
8 | 8 |
|
9 |
- if(file_exists(MODELS_PATH.DIRECTORY_SEPARATOR.$base_param['name'].'.php')){ |
|
9 |
+ if(file_exists(MODELS_PATH.DIRECTORY_SEPARATOR.$base_param['name'].'.model')){ |
|
10 |
+ $fichier = file(MODELS_PATH.DIRECTORY_SEPARATOR.$base_param['name'].'.model'); |
|
11 |
+ foreach ($fichier as $ligne_num => $ligne) { |
|
12 |
+ if(preg_match("#[ ]*([a-zA-Z_]*)[ ]*[:][ ]*([a-zA-Z ]*[ ]*)#",$ligne,$matches)){ |
|
13 |
+ $this->page[$matches[1]] = $matches[2]; |
|
14 |
+ } |
|
15 |
+ } |
|
10 | 16 |
include MODELS_PATH.DIRECTORY_SEPARATOR.$base_param['name'].'.php'; |
11 | 17 |
}else{ |
12 | 18 |
$this->page['name'] = $base_param['name']; |
... | ... |
@@ -0,0 +1,14 @@ |
1 |
+<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline --> |
|
2 |
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> |
|
3 |
+ <script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js"><\/script>')</script> |
|
4 |
+ |
|
5 |
+ <!-- end scripts --> |
|
6 |
+ |
|
7 |
+ <!-- Asynchronous Google Analytics snippet. Change UA-XXXXX-X to be your site's ID. |
|
8 |
+ mathiasbynens.be/notes/async-analytics-snippet --> |
|
9 |
+ <script> |
|
10 |
+ var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']]; |
|
11 |
+ (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; |
|
12 |
+ g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js'; |
|
13 |
+ s.parentNode.insertBefore(g,s)}(document,'script')); |
|
14 |
+ </script> |
|
0 | 15 |
\ No newline at end of file |
... | ... |
@@ -0,0 +1,18 @@ |
1 |
+<!doctype html> |
|
2 |
+ |
|
3 |
+<html lang="fr"> |
|
4 |
+ |
|
5 |
+<head> |
|
6 |
+ <meta charset="utf-8"> |
|
7 |
+ |
|
8 |
+ <title><?php echo $name ?></title> |
|
9 |
+ <meta name="description" content= <?php echo '"'.$description.'"' ?> > |
|
10 |
+ |
|
11 |
+ <!-- Mobile viewport optimized: h5bp.com/viewport --> |
|
12 |
+ <meta name="viewport" content="width=device-width"> |
|
13 |
+ |
|
14 |
+ <!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons --> |
|
15 |
+ |
|
16 |
+ echo LAYOUT_TEMPLATE.DIRECTORY_SEPARATOR."top-css.pthml" |
|
17 |
+ |
|
18 |
+</head> |
... | ... |
@@ -1,21 +1,10 @@ |
1 |
-<!doctype html> |
|
1 |
+<?php |
|
2 |
+define('LAYOUT_TEMPLATE',dirname(__FILE__).DIRECTORY_SEPARATOR.'include'.DIRECTORY_SEPARATOR.'standart'); |
|
2 | 3 |
|
3 |
-<html lang="fr"> |
|
4 | 4 |
|
5 |
-<head> |
|
6 |
- <meta charset="utf-8"> |
|
5 |
+ echo LAYOUT_TEMPLATE.DIRECTORY_SEPARATOR."head.pthml" |
|
7 | 6 |
|
8 |
- <title><?php echo $name ?></title> |
|
9 |
- <meta name="description" content= <?php echo '"'.$description.'"' ?> > |
|
10 | 7 |
|
11 |
- <!-- Mobile viewport optimized: h5bp.com/viewport --> |
|
12 |
- <meta name="viewport" content="width=device-width"> |
|
13 |
- |
|
14 |
- <!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons --> |
|
15 |
- |
|
16 |
- <link rel="stylesheet" href="css/style.css"> |
|
17 |
- |
|
18 |
-</head> |
|
19 | 8 |
<body> |
20 | 9 |
|
21 | 10 |
<!-- Prompt IE 6 users to install Chrome Frame. Remove this if you support IE 6. |
... | ... |
@@ -24,33 +13,19 @@ |
24 | 13 |
|
25 | 14 |
|
26 | 15 |
<header> |
27 |
- <h4>Head PROJECT</h4> |
|
16 |
+ echo LAYOUT_TEMPLATE.DIRECTORY_SEPARATOR."header.pthml" |
|
28 | 17 |
</header> |
29 | 18 |
|
30 |
- <div role="main"> |
|
31 |
- <?php echo $this->block_body ?> |
|
32 |
- </div> |
|
19 |
+ |
|
20 |
+ echo LAYOUT_TEMPLATE.DIRECTORY_SEPARATOR."body.pthml" |
|
33 | 21 |
|
34 | 22 |
<footer> |
35 |
- <h4>Tail PROJECT</h4> |
|
23 |
+ echo LAYOUT_TEMPLATE.DIRECTORY_SEPARATOR."header.pthml" |
|
36 | 24 |
</footer> |
37 | 25 |
|
38 | 26 |
|
39 | 27 |
<!-- JavaScript at the bottom for fast page loading --> |
40 |
- |
|
41 |
- <!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline --> |
|
42 |
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> |
|
43 |
- <script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.1.min.js"><\/script>')</script> |
|
44 |
- |
|
45 |
- <!-- end scripts --> |
|
46 |
- |
|
47 |
- <!-- Asynchronous Google Analytics snippet. Change UA-XXXXX-X to be your site's ID. |
|
48 |
- mathiasbynens.be/notes/async-analytics-snippet --> |
|
49 |
- <script> |
|
50 |
- var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']]; |
|
51 |
- (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0]; |
|
52 |
- g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js'; |
|
53 |
- s.parentNode.insertBefore(g,s)}(document,'script')); |
|
54 |
- </script> |
|
28 |
+ echo LAYOUT_TEMPLATE.DIRECTORY_SEPARATOR."bottom-javascript.pthml" |
|
29 |
+ |
|
55 | 30 |
</body> |
56 | 31 |
</html> |