diff --git a/bdd_proj.sql b/bdd_proj.sql index 74895f6..98ab8fa 100755 --- a/bdd_proj.sql +++ b/bdd_proj.sql @@ -1,9 +1,9 @@ CREATE TABLE images ( id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, - date DATETIME, + date DATETIME, name VARCHAR(32), alt VARCHAR(128), - post_id INT + post_id INT ); CREATE TABLE posts ( @@ -12,7 +12,7 @@ CREATE TABLE posts ( url VARCHAR(32), content TEXT, short varchar(256), - dt DATETIME DEFAULT CURRENT_TIMESTAMP, + dt TIMESTAMP DEFAULT CURRENT_TIMESTAMP, categorie INT, author INT ); @@ -70,7 +70,7 @@ INSERT INTO users (username, linkedin) VALUES ('Florian Bouillon', NULL), ('Adri INSERT INTO categories (name) VALUES ('devops'), ('ops'), ('dev'), ('digi'); -- requete 1 : --- recuperer 10 posts avec la categorie associé la date du post et les 256 premiers mots du contenu +-- recuperer 10 posts avec la categorie associé la date du post et les 256 premiers mots du contenu SELECT title, short, categorie, url FROM posts LIMIT 10; @@ -83,8 +83,8 @@ FROM post INNER JOIN users BY post.author=user.id LIMIT 1; --- requette 3 : comme la 1 sauf uniquement les 6 posts les plus récents --- requete lancée lors sur la page d'accueil +-- requette 3 : comme la 1 sauf uniquement les 6 posts les plus récents +-- requete lancée lors sur la page d'accueil SELECT title, categories.name as categorie, dt as date, short as content FROM posts INNER JOIN categories ON categories.id=posts.categorie diff --git a/project/assets/html/index.html b/project/assets/html/index.html index 32eba74..01afe05 100755 --- a/project/assets/html/index.html +++ b/project/assets/html/index.html @@ -30,7 +30,6 @@ -

Articles récents

@@ -49,7 +48,8 @@
-

+

+
diff --git a/project/assets/php/pages.php b/project/assets/php/pages.php index 2199846..69d74fa 100755 --- a/project/assets/php/pages.php +++ b/project/assets/php/pages.php @@ -27,7 +27,7 @@ $search = function () { $router->addRoute("/^\/search\/$/", $search); // route "/search/*" -$post = function() { +$edit = function() { $_POST = array_merge($_POST, $_GET); //debug uniquement var_dump($_POST); /* @@ -78,4 +78,4 @@ $post = function() { $prepared->execute(); }; -$router->addRoute("/^\/post\/" . $postCharacters . "+\/edit\/*$/", $post); +$router->addRoute("/^\/post\/" . $postCharacters . "+\/edit\/*$/", $edit); diff --git a/project/assets/php/tagHandler.php b/project/assets/php/tagHandler.php index adcd024..8d7c63b 100755 --- a/project/assets/php/tagHandler.php +++ b/project/assets/php/tagHandler.php @@ -273,7 +273,6 @@ function loadTags($ctnt) { $head->item(0)->appendChild($t); } - $test = array(); $list = $dom->getElementsByTagName("tag"); @@ -281,26 +280,12 @@ function loadTags($ctnt) { while($lst = $list->item(0)) { $tgs = ucfirst($lst->getAttribute("type")); - array_push($test, $tgs); $tg = new $tgs($dom, $lst, false); $tg->render(); - // var_dump("--------- 1 ---------"); - // for ($i=0; $i < $list->count(); $i++) { - // var_dump($list->item($i)->getAttribute("type")); - // } - // echo (htmlspecialchars($dom->saveHTML())); - - // var_dump($list[0]->parentNode->nodeName); $lst->parentNode->removeChild($lst); - // var_dump("--------- 2 ---------"); - // for ($i=0; $i < $list->count(); $i++) { - // var_dump($list->item($i)->getAttribute("type")); - // } - // echo (htmlspecialchars($dom->saveHTML())); - $list = $dom->getElementsByTagName("tag"); }