diff --git a/mvc_PSR4_twig/modeles/Connection.php b/mvc_PSR4_twig/DAL/Connection.php similarity index 98% rename from mvc_PSR4_twig/modeles/Connection.php rename to mvc_PSR4_twig/DAL/Connection.php index da7062f..8be3ee1 100644 --- a/mvc_PSR4_twig/modeles/Connection.php +++ b/mvc_PSR4_twig/DAL/Connection.php @@ -1,6 +1,6 @@ render('vuephp1.html', ['dVueEreur' => $dVueEreur]); + $dataview = ['Article'=> $tabArticle]; + echo $twig->render('listArticle.html', ['tabArticle' => $dataview, 'dVueErreur'=>$dVueEreur]); break; } } catch (\PDOException $e) { @@ -67,7 +69,7 @@ class Controleur $age = $_POST['txtAge']; \config\Validation::val_form($nom, $age, $dVueEreur); - $model = new \modeles\Simplemodel(); + $model = new \metier\Simplemodel(); $data = $model->get_data(); $dVue = [ diff --git a/mvc_PSR4_twig/index.php b/mvc_PSR4_twig/index.php index 0c2f9ea..e38d3b0 100755 --- a/mvc_PSR4_twig/index.php +++ b/mvc_PSR4_twig/index.php @@ -10,7 +10,7 @@ use controleur\Controleur; //twig $loader = new \Twig\Loader\FilesystemLoader('templates'); $twig = new \Twig\Environment($loader, [ - 'cache' => 'cache', + 'cache' => false, ]); $cont = new Controleur(); diff --git a/mvc_PSR4_twig/modeles/Article.php b/mvc_PSR4_twig/metier/Article.php old mode 100755 new mode 100644 similarity index 85% rename from mvc_PSR4_twig/modeles/Article.php rename to mvc_PSR4_twig/metier/Article.php index 0a17611..50a6370 --- a/mvc_PSR4_twig/modeles/Article.php +++ b/mvc_PSR4_twig/metier/Article.php @@ -1,6 +1,6 @@ id = $id; $this->title = $title; @@ -30,6 +32,7 @@ class Article $this->guid = $guid; $this->link = $link; $this->mediaContent = $mediaContent; + $this->provenance = $provenance; } public function getId(): int @@ -102,5 +105,14 @@ class Article $this->mediaContent = $mediaContent; } + public function getProvenance(): int + { + return $this->provenance; + } + + public function setProvenance(int $provenance): void + { + $this->provenance = $provenance; + } } \ No newline at end of file diff --git a/mvc_PSR4_twig/modeles/Flux.php b/mvc_PSR4_twig/metier/Flux.php similarity index 52% rename from mvc_PSR4_twig/modeles/Flux.php rename to mvc_PSR4_twig/metier/Flux.php index e99d929..01a40e5 100644 --- a/mvc_PSR4_twig/modeles/Flux.php +++ b/mvc_PSR4_twig/metier/Flux.php @@ -1,6 +1,6 @@ getAllArticles(); + foreach($res as $row){ + $tabArticle[] = new metier\Article($row['id'], $row['title'],$row['datePub'],$row['description'],$row['guid'],$row['link'],$row['mediaContent'],$row['provenance'] ); + } + return $tabArticle; + } +} \ No newline at end of file diff --git a/mvc_PSR4_twig/modeles/FluxModel.php b/mvc_PSR4_twig/model/FluxModel.php similarity index 57% rename from mvc_PSR4_twig/modeles/FluxModel.php rename to mvc_PSR4_twig/model/FluxModel.php index fac3177..948af8a 100644 --- a/mvc_PSR4_twig/modeles/FluxModel.php +++ b/mvc_PSR4_twig/model/FluxModel.php @@ -1,6 +1,6 @@ + + + + All Articles + + +{% for value in tabArticle.Article %} +

{{value}}

+{% endfor %} + + \ No newline at end of file