Commit e7ffa7e6 authored by Corentin Bettiol's avatar Corentin Bettiol 💻

little change; the website generate slug when a blogpost/project is created,...

little change; the website generate slug when a blogpost/project is created, and this slug is used in the url to access the blogpost/project
parent 87ec978e
...@@ -11,5 +11,4 @@ require_once('site/controller/adminController.php'); ...@@ -11,5 +11,4 @@ require_once('site/controller/adminController.php');
// afficher le contenu (qui va switcher sur le contenu dynamique à afficher) // afficher le contenu (qui va switcher sur le contenu dynamique à afficher)
require_once('site/layout/layout.php'); require_once('site/layout/layout.php');
?> ?>
\ No newline at end of file
...@@ -12,17 +12,8 @@ ...@@ -12,17 +12,8 @@
RewriteEngine On RewriteEngine On
RewriteRule ^/(about|changelog|blog|rss|projects|contact|patate|eplucher)$ /index.php?action=$1 RewriteRule ^/(about|changelog|blog|rss|projects|contact|patate|eplucher)$ /index.php?action=$1
RewriteRule ^/article/([a-zA-Z0-9\-:!?+.;/,\%9áàâäãåçéèêëíìîïñóòôöõúùûüýÿæœÁÀÂÄÃÅÇÉÈÊËÍÌÎÏÑÓÒÔÖÕÚÙÛÜÝŸÆŒ]*)$ /index.php?action=blog&title=$1 RewriteRule ^/article/([-a-z0-9]+)$ /index.php?action=blog&title=$1
RewriteRule ^/project/([a-zA-Z0-9\-:!?+.;/,\%9áàâäãåçéèêëíìîïñóòôöõúùûüýÿæœÁÀÂÄÃÅÇÉÈÊËÍÌÎÏÑÓÒÔÖÕÚÙÛÜÝŸÆŒ]*)$ /index.php?action=project&title=$1 RewriteRule ^/project/([-a-z0-9]+)$ /index.php?action=project&title=$1
RewriteRule ^/patate/blog/([a-zA-Z0-9\-:!?+.;/,\%9áàâäãåçéèêëíìîïñóòôöõúùûüýÿæœÁÀÂÄÃÅÇÉÈÊËÍÌÎÏÑÓÒÔÖÕÚÙÛÜÝŸÆŒ]*)/edit$ /index.php?action=patate&title=$1&editb RewriteRule ^/patate/(blog|project)/([-a-z0-9]+)/(edit|submit|delete)$ /index.php?action=patate&type=$1$3&title=$2
RewriteRule ^/patate/blog/([a-zA-Z0-9\-:!?+.;/,\%9áàâäãåçéèêëíìîïñóòôöõúùûüýÿæœÁÀÂÄÃÅÇÉÈÊËÍÌÎÏÑÓÒÔÖÕÚÙÛÜÝŸÆŒ]*)/delete$ /index.php?action=patate&title=$1&deleteb
RewriteRule ^/patate/blog/submit$ /index.php?action=patate&submitb
RewriteRule ^/patate/blog/edit$ /index.php?action=patate&editb
RewriteRule ^/patate/blog/send$ /index.php?action=patate&sendb
RewriteRule ^/patate/project/([a-zA-Z0-9\-:!?+.;/,\%9áàâäãåçéèêëíìîïñóòôöõúùûüýÿæœÁÀÂÄÃÅÇÉÈÊËÍÌÎÏÑÓÒÔÖÕÚÙÛÜÝŸÆŒ]*)/edit$ /index.php?action=patate&title=$1&editp
RewriteRule ^/patate/project/([a-zA-Z0-9\-:!?+.;/,\%9áàâäãåçéèêëíìîïñóòôöõúùûüýÿæœÁÀÂÄÃÅÇÉÈÊËÍÌÎÏÑÓÒÔÖÕÚÙÛÜÝŸÆŒ]*)/delete$ /index.php?action=patate&title=$1&deletep
RewriteRule ^/patate/project/submit$ /index.php?action=patate&submitp
RewriteRule ^/patate/project/edit$ /index.php?action=patate&editp
RewriteRule ^/patate/project/send$ /index.php?action=patate&sendp
</VirtualHost> </VirtualHost>
...@@ -6,8 +6,7 @@ require_once('site/model/AdminManager.php'); ...@@ -6,8 +6,7 @@ require_once('site/model/AdminManager.php');
// tente de connecter l'administrateur // tente de connecter l'administrateur
function loginAdminPage($pageName){ function loginAdminPage($pageName){
if(password_verify($_POST['pass'], pass) && $_POST['user'] == user){ if(password_verify($_POST['pass'], pass) && $_POST['user'] == user){
$_SESSION['user'] = $_POST['user']; $_SESSION['user'] = user;
$_SESSION['pass'] = $_POST['pass'];
header('Location:/patate'); header('Location:/patate');
} }
else else
...@@ -17,65 +16,79 @@ function loginAdminPage($pageName){ ...@@ -17,65 +16,79 @@ function loginAdminPage($pageName){
// afficher le panneau d'administration & gère l'administration du site // afficher le panneau d'administration & gère l'administration du site
function writeAdminPage($pageName){ function writeAdminPage($pageName){
$admin = new AdminManager(); $admin = new AdminManager();
if($admin->verifyAdminConnect()){ if($admin->verifyAdminConnect()){
if(isset($_GET['editb'])){ if(isset($_GET['type'])){
if(isset($_GET['title'])){ switch ($_GET['type']){
$title = urldecode($_GET['title']);
if($blogpost = $admin->getBlogPost($title)) case 'blogedit':
require('site/view/private/editblogView.php'); if(!isset($_POST['title'])){
else $title = htmlspecialchars($_GET['title']);
header('Location:/404'); if($blogpost = $admin->getBlogPost($title))
} require('site/view/private/editblogView.php');
else{ else
$admin->updateBlogPost(); header('Location:/404');
header('Location:/patate'); }
} else{
} $admin->updateBlogPost();
else if(isset($_GET['editp'])){ header('Location:/patate');
if(isset($_GET['title'])){ }
$title = urldecode($_GET['title']); break;
$project = $admin->getProject($title);
require('site/view/private/editProjectView.php'); case 'blogsubmit':
} if(isset($_POST['title'])){
else{ $admin->sendBlogPost();
$admin->updateProject(); //header('Location:/patate');
header('Location:/patate'); }
} else
} require('site/view/private/createBlogView.php');
else if(isset($_GET['submitb'])){ break;
require('site/view/private/createBlogView.php');
} case 'blogdelete':
else if(isset($_GET['submitp'])){ if(isset($_GET['title'])){
require('site/view/private/createProjectView.php'); $admin->deleteBlogPost($_GET['title']);
} header('Location:/patate');
else if(isset($_GET['sendb'])){ }
$admin->sendBlogPost(); break;
header('Location:/');
} case 'projectedit':
else if(isset($_GET['sendp'])){ if(!isset($_POST['name'])){
$admin->sendProject(); $title = urldecode($_GET['title']);
header('Location:/projects'); $project = $admin->getProject($title);
} require('site/view/private/editProjectView.php');
else if(isset($_GET['deleteb'])){ }
if(isset($_GET['title'])){ else{
$title = urldecode($_GET['title']); $admin->updateProject();
$admin->deleteBlogPost($title); header('Location:/patate');
header('Location:/patate'); }
} break;
}
else if(isset($_GET['deletep'])){ case 'projectsubmit':
if(isset($_GET['title'])){ if(isset($_POST['name'])){
$title = urldecode($_GET['title']); $admin->sendProject();
$admin->deleteProject($title); header('Location:/patate');
header('Location:/patate'); }
else
require('site/view/private/createProjectView.php');
break;
case 'projectdelete':
if(isset($_GET['title'])){
$admin->deleteProject($_GET['title']);
header('Location:/patate');
}
break;
default:
# code...
break;
} }
} }
else{ else{
$blogposts = $admin->getBlogPosts(); $blogposts = $admin->getBlogPosts();
$projects = $admin->getProjects(); $projects = $admin->getProjects();
require('site/view/private/admin.php'); require('site/view/private/admin.php');
} }
} }
else else
......
...@@ -87,8 +87,8 @@ function writeBlogPage($pageName){ ...@@ -87,8 +87,8 @@ function writeBlogPage($pageName){
$blogpost = $blog->get($title); $blogpost = $blog->get($title);
if($blogpost != false) if($blogpost != false)
require('site/view/public/blogPostView.php'); require('site/view/public/blogPostView.php');
else //else
header('Location:/404'); // header('Location:/404');
} }
// si on affiche la liste des posts // si on affiche la liste des posts
else{ else{
...@@ -106,10 +106,11 @@ function writeProjectPage($pageName){ ...@@ -106,10 +106,11 @@ function writeProjectPage($pageName){
if(isset($_GET['title'])){ if(isset($_GET['title'])){
$title = urldecode($_GET['title']); $title = urldecode($_GET['title']);
$project = $project->get($title); $project = $project->get($title);
if($project != false) if($project != false){
require('site/view/public/projectView.php'); require('site/view/public/projectView.php');
else }
header('Location:/404'); //else
// header('Location:/404');
} }
// si on affiche la liste des projets // si on affiche la liste des projets
else{ else{
......
...@@ -17,19 +17,19 @@ class AdminManager extends Base ...@@ -17,19 +17,19 @@ class AdminManager extends Base
public function getBlogPost($link) public function getBlogPost($link)
{ {
$blogpost = new BlogManager(null, null, null, null, null, null); // moche :c $blogpost = new BlogManager(null, null, null, null, null, null);
return $blogpost->get($link); return $blogpost->get($link);
} }
public function getProject($link) public function getProject($link)
{ {
$project = new ProjectManager(null,null,null,null,null); // moche :c $project = new ProjectManager(null,null,null,null,null);
return $project->get($link); return $project->get($link);
} }
public function verifyAdminConnect(){ public function verifyAdminConnect(){
return isset($_SESSION['user']) && $_SESSION['user'] == user && isset($_SESSION['pass']) && password_verify($_SESSION['pass'], pass); return isset($_SESSION['user']) && $_SESSION['user'] == user;
} }
public function updateBlogPost(){ public function updateBlogPost(){
...@@ -43,13 +43,13 @@ class AdminManager extends Base ...@@ -43,13 +43,13 @@ class AdminManager extends Base
} }
public function sendBlogPost(){ public function sendBlogPost(){
$blog = new BlogManager($_POST['time'], $_POST['title'], $_POST['content'], $_POST['shortContent'], $_POST['id']); $blog = new BlogManager($_POST['time'], $_POST['title'], $_POST['content'], $_POST['shortContent'], null);
$blog->send(); $blog->send();
} }
public function sendProject(){ public function sendProject(){
$project = new ProjectManager($_POST['name'], $_POST['link'], $_POST['content'], $_POST['shortContent'], $_POST['id']); $project = new ProjectManager($_POST['name'], $_POST['link'], $_POST['content'], $_POST['shortContent'], null);
$project->send(); $project->send();
} }
......
...@@ -7,4 +7,14 @@ class Base ...@@ -7,4 +7,14 @@ class Base
$db = new PDO('mysql:host=localhost;dbname='. dbName .';charset=utf8', dbUser, dbPass); $db = new PDO('mysql:host=localhost;dbname='. dbName .';charset=utf8', dbUser, dbPass);
return $db; return $db;
} }
# thanks https://www.matthecat.com/supprimer-les-accents-dune-chaine-en-php/ & http://php.net/manual/fr/transliterator.transliterate.php#110598
protected function slugify($text){
$slug = preg_replace('/&amp;/', 'et', $text);
$slug = transliterator_transliterate("Any-Latin; NFD; [:Nonspacing Mark:] Remove; NFC; [:Punctuation:] Remove; Lower();", $slug);
$slug = preg_replace('/[-\s]+/', '-', $slug);
$slug = preg_replace('/-$/', '', $slug);
$slug = preg_replace('/[^a-z0-9-]+/', '', $slug);
return $slug;
}
} }
\ No newline at end of file
...@@ -29,20 +29,16 @@ class BlogManager extends Base ...@@ -29,20 +29,16 @@ class BlogManager extends Base
public function get($link) public function get($link)
{ {
$link = htmlspecialchars($link); $link = htmlspecialchars($link);
$title = str_replace('-', ' ', $link);
$db = $this->dbConnect(); $db = $this->dbConnect();
$req = $db->prepare('SELECT * FROM l3m_blog WHERE title = ?'); $req = $db->prepare('SELECT * FROM l3m_blog WHERE slug = ?');
$req->execute([$title]); $req->execute([$link]);
$post = $req->fetch(); $post = $req->fetch();
if($post == false) if($post == false)
return false; return false;
$post['link'] = urlencode($link);
$post['datetime'] = new DateTime($post['time']); $post['datetime'] = new DateTime($post['time']);
return $post; return $post;
...@@ -73,11 +69,15 @@ class BlogManager extends Base ...@@ -73,11 +69,15 @@ class BlogManager extends Base
if(strlen($this->shortContent) < 1){ if(strlen($this->shortContent) < 1){
$this->shortContent = 'Ce billet de blog ne dispose d\'aucune description.'; $this->shortContent = 'Ce billet de blog ne dispose d\'aucune description.';
} }
$this->slug = $this->slugify($this->title);
$db = $this->dbConnect(); $db = $this->dbConnect();
$req = $db->prepare('INSERT INTO l3m_blog(time, title, content, shortcontent) VALUES(:time, :title, :content, :shortContent)'); $req = $db->prepare('INSERT INTO l3m_blog(time, title, slug, content, shortcontent) VALUES(:time, :title, :slug, :content, :shortContent)');
$req->execute([ $req->execute([
'time' => $this->time, 'time' => $this->time,
'title' => $this->title, 'title' => $this->title,
'slug' => $this->slug,
'content' => $this->content, 'content' => $this->content,
'shortContent' => $this->shortContent 'shortContent' => $this->shortContent
]); ]);
...@@ -85,12 +85,10 @@ class BlogManager extends Base ...@@ -85,12 +85,10 @@ class BlogManager extends Base
public function delete($link){ public function delete($link){
$title = str_replace('-', ' ', $link); $link = htmlspecialchars($link);
$db = $this->dbConnect(); $db = $this->dbConnect();
$req = $db->prepare('DELETE FROM l3m_blog WHERE title = :title'); $req = $db->prepare('DELETE FROM l3m_blog WHERE slug = ?');
$req->execute([ $req->execute([$link]);
'title' => $title
]);
} }
} }
\ No newline at end of file
...@@ -26,11 +26,10 @@ class ProjectManager extends Base ...@@ -26,11 +26,10 @@ class ProjectManager extends Base
public function get($link) public function get($link)
{ {
$link = htmlspecialchars($link); $link = htmlspecialchars($link);
$name = str_replace('-', ' ', $link);
$db = $this->dbConnect(); $db = $this->dbConnect();
$req = $db->prepare('SELECT * FROM l3m_projects WHERE name = ?'); $req = $db->prepare('SELECT * FROM l3m_projects WHERE slug = ?');
$req->execute([$name]); $req->execute([$link]);
$project = $req->fetch(); $project = $req->fetch();
if($project == false) if($project == false)
...@@ -60,10 +59,13 @@ class ProjectManager extends Base ...@@ -60,10 +59,13 @@ class ProjectManager extends Base
if(strlen($this->shortContent) < 1){ if(strlen($this->shortContent) < 1){
$this->shortContent = 'Pas de description.'; $this->shortContent = 'Pas de description.';
} }
$this->slug = $this->slugify($this->name);
$db = $this->dbConnect(); $db = $this->dbConnect();
$req = $db->prepare('INSERT INTO l3m_projects(name, link, content, shortcontent) VALUES(:name, :link, :content, :shortContent)'); $req = $db->prepare('INSERT INTO l3m_projects(name, slug, link, content, shortcontent) VALUES(:name, :slug, :link, :content, :shortContent)');
$req->execute([ $req->execute([
'name' => $this->name, 'name' => $this->name,
'slug' => $this->slug,
'link' => $this->link, 'link' => $this->link,
'content' => $this->content, 'content' => $this->content,
'shortContent' => $this->shortContent 'shortContent' => $this->shortContent
...@@ -71,12 +73,10 @@ class ProjectManager extends Base ...@@ -71,12 +73,10 @@ class ProjectManager extends Base
} }
public function delete($link){ public function delete($link){
$title = str_replace('-', ' ', $link); $link = htmlspecialchars($link);
$db = $this->dbConnect(); $db = $this->dbConnect();
$req = $db->prepare('DELETE FROM l3m_projects WHERE name = :name'); $req = $db->prepare('DELETE FROM l3m_projects WHERE slug = ?');
$req->execute([ $req->execute([$link]);
'name' => $title
]);
} }
} }
\ No newline at end of file
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<article> <article>
<h3>Post d'un billet de blog</h3> <h3>Post d'un billet de blog</h3>
<form action="/patate/blog/send" method="post" accept-charset="utf-8"> <form action="/patate/blog/submit" method="post" accept-charset="utf-8">
<section class="input"> <section class="input">
<label for="inputTitle">Titre</label> <label for="inputTitle">Titre</label>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<article> <article>
<h3>Post d'un nouveau projet</h3> <h3>Post d'un nouveau projet</h3>
<form action="/patate/project/send" method="post" accept-charset="utf-8"> <form action="/patate/project/submit" method="post" accept-charset="utf-8">
<input type="hidden" name="id" value="<?php echo $project['id']; ?>" /> <input type="hidden" name="id" value="<?php echo $project['id']; ?>" />
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<article> <article>
<h3>Édition du projet #<?php echo $project['id']; ?></h3> <h3>Édition du projet #<?php echo $project['id']; ?></h3>
<form action="/patate/project/edit" method="post" accept-charset="utf-8"> <form action="/patate/project/<?php echo $project['slug'] ?>/edit" method="post" accept-charset="utf-8">
<input type="hidden" name="id" value="<?php echo $project['id']; ?>" /> <input type="hidden" name="id" value="<?php echo $project['id']; ?>" />
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<article> <article>
<h3>Édition du billet de blog #<?php echo $blogpost['id']; ?></h3> <h3>Édition du billet de blog #<?php echo $blogpost['id']; ?></h3>
<form action="/patate/blog/edit" method="post" accept-charset="utf-8"> <form action="/patate/blog/<?php echo $blogpost['slug']; ?>/edit" method="post" accept-charset="utf-8">
<input type="hidden" name="id" value="<?php echo $blogpost['id']; ?>" /> <input type="hidden" name="id" value="<?php echo $blogpost['id']; ?>" />
......
...@@ -4,17 +4,14 @@ ...@@ -4,17 +4,14 @@
exit(); exit();
} }
$hr = false;
foreach ($blogposts as $post){ foreach ($blogposts as $post){
$post['datetime'] = new DateTime($post['time']); $post['datetime'] = new DateTime($post['time']);
$post['link'] = urlencode(str_replace(' ', '-', $post['title']));
$exist = true; $exist = true;
?> ?>
<article> <article>
<p class="listAdmin"> <p class="listAdmin">
<b><a href="/article/<?php echo $post['link']; ?>"><?php echo $post['title'] ?></a></b> <b><a href="/article/<?php echo $post['slug']; ?>"><?php echo $post['title'] ?></a></b>
<span class="postInfos"><?php echo date_format($post['datetime'], 'd/m/Y à H:i'); ?></span> <a class="button" href="/patate/blog/<?php echo $post['link']; ?>/edit">éditer</a> <a class="button" href="/patate/blog/<?php echo $post['link'] ."/delete"; ?>" onclick="return confirm('C\'est certain ?')"></a> <span class="postInfos"><?php echo date_format($post['datetime'], 'd/m/Y à H:i'); ?></span> <a class="button" href="/patate/blog/<?php echo $post['slug']; ?>/edit">éditer</a> <a class="button" href="/patate/blog/<?php echo $post['slug'] ."/delete"; ?>" onclick="return confirm('C\'est certain ?')"></a>
</p> </p>
</article> </article>
<?php <?php
......
...@@ -4,16 +4,14 @@ ...@@ -4,16 +4,14 @@
exit(); exit();
} }
$hr = false;
foreach ($projects as $project){ foreach ($projects as $project){
$project['internalLink'] = urlencode(str_replace(' ', '-', $project['name']));
$exist = true; $exist = true;
?> ?>
<article> <article>
<p class="listAdmin"> <p class="listAdmin">
<b><a href="/project/<?php echo $project['internalLink']; ?>"><?php echo $project['name'] ?></a></b> <b><a href="/project/<?php echo $project['slug']; ?>"><?php echo $project['name'] ?></a></b>
<span class="postInfos"><?php echo $project['link']; ?></span> <a class="button" href="/patate/project/<?php echo $project['internalLink'] ."/edit"; ?>">éditer</a> <a class="button" href="/patate/project/<?php echo $project['internalLink'] ."/delete"; ?>" onclick="return confirm('C\'est certain ?')"></a> <span class="postInfos"><?php echo $project['link']; ?></span> <a class="button" href="/patate/project/<?php echo $project['slug'] ."/edit"; ?>">éditer</a> <a class="button" href="/patate/project/<?php echo $project['slug'] ."/delete"; ?>" onclick="return confirm('C\'est certain ?')"></a>
</p> </p>
</article> </article>
<?php <?php
......
...@@ -6,14 +6,14 @@ ...@@ -6,14 +6,14 @@
?> ?>
<article> <article>
<h3><a href="/article/<?php echo $blogpost['link']; ?>"><?php echo $blogpost['title']; ?></a></h3> <h3><a href="/article/<?php echo $blogpost['slug']; ?>"><?php echo $blogpost['title']; ?></a></h3>
<p class="postInfos"> <p class="postInfos">
Le <time datetime="<?php echo $blogpost['time']; ?>"><?php echo date_format($blogpost['datetime'], 'd/m/Y à H:i'); ?></time>. Le <time datetime="<?php echo $blogpost['time']; ?>"><?php echo date_format($blogpost['datetime'], 'd/m/Y à H:i'); ?></time>.
</p> </p>
<section> <section>
<p> <p>
<?php <?php
if(isset($hr)) if(isset($_GET['title']))
echo $blogpost['shortContent']; echo $blogpost['shortContent'];
else else
echo nl2br($blogpost['content']); echo nl2br($blogpost['content']);
......
...@@ -4,10 +4,7 @@ ...@@ -4,10 +4,7 @@
exit(); exit();
} }
$hr = false;
foreach ($blogposts as $blogpost){ foreach ($blogposts as $blogpost){
$blogpost['link'] = urlencode(str_replace(' ', '-', $blogpost['title']));
$blogpost['datetime'] = new DateTime($blogpost['time']); $blogpost['datetime'] = new DateTime($blogpost['time']);
$exist = true; $exist = true;
......
<article> <article>
<h3><a href="">01/03/19</a></h3> <h3><a href="">01/03/19</a> (encore)</h3>
<ul>
<li>Réorganisation de la gestion des url des pages :
<ul>
<li>Modification du fichier l3m-website-dist.conf, avec les bonnes règles d'urlrewriting</li>
<li>Beauuucoup de changements dans les fichiers de classe d'admin, de blog & de projet</li>
<li>Utilisation de l'extension IntL pour la fonction slugify() dans la classe Base (servant à générer les url)</li>
</ul>
</li>
</ul>
</article>
<article>
<h3><a href="https://git.bitmycode.com/sodimel/l3m-website/commit/3e33e9c76cc1f335ff91be357168352791c4d3a2" title="3e33e9c7">01/03/19</a></h3>
<ul> <ul>
<li>Suppression de toutes les balises &lt;hr /&gt; (qui servent à séparer des paragraphes et pas des sections)</li> <li>Suppression de toutes les balises &lt;hr /&gt; (qui servent à séparer des paragraphes et pas des sections)</li>
<li>Création du fichier adminController.php, avec les fonctions d'administration dedans</li> <li>Création du fichier adminController.php, avec les fonctions d'administration dedans</li>
......
...@@ -24,19 +24,19 @@ ...@@ -24,19 +24,19 @@
<ul> <ul>
<li> <li>
<a href="https://git.bitmycode.com/sodimel/">git.bitmycode</a>.com <a href="https://git.bitmycode.com/sodimel/">git.bitmycode.com</a>, l'instange gitlab de BitMyCode.
</li> </li>
<li> <li>
<a href="https://gitlab.com/sodimel/">gitlab</a>.com <a href="https://gitlab.com/sodimel/">gitlab.com</a>
</li> </li>
<li> <li>
<a href="https://github.com/corentinbettiol/">github</a> <a href="https://github.com/corentinbettiol/">github</a>, comme gitlab mais en moins bien
</li> </li>
<li> <li>
<a href="https://codepen.io/lmmm/">codepen</a> <a href="https://codepen.io/lmmm/">codepen</a>, parce que le CSS c'est rigolo
</li> </li>
<li> <li>
<a href="https://dribbble.com/sodimel">dribbble</a> <a href="https://dribbble.com/sodimel">dribbble</a>, parce que le CSS c'est une forme de design
</li> </li>
</ul> </ul>
</article> </article>
......
...@@ -3,23 +3,12 @@ ...@@ -3,23 +3,12 @@
header('Location:/'); header('Location:/');
exit(); exit();
} }
$project['internalLink'] = urlencode(str_replace(' ', '-', $project['name']));
?> ?>
<article> <article>
<h3><a href="<?php echo $project['link']; ?>"><?php echo $project['name']; ?></a></h3> <h3><a href="<?php echo $project['link']; ?>"><?php echo $project['name']; ?></a></h3>
<p> <p>
<?php <?php
if(isset($project['pageProject'])){
echo nl2br($project['content']); echo nl2br($project['content']);
}
else{
echo $project['shortContent'];
?>
<br />
<span class="postInfos"><a href="/project/<?php echo $project['internalLink']; ?>">Plus d'infos.</a></span>
<?php
}
?> ?>
</p> </p>
</article> </article>
\ No newline at end of file
...@@ -5,14 +5,13 @@ ...@@ -5,14 +5,13 @@
} }
foreach ($projects as $project){ foreach ($projects as $project){
$project['internalLink'] = urlencode(str_replace(' ', '-', $project['name']));
$exist = true; $exist = true;
?> ?>
<article> <article>
<h3><a href="<?php echo $project['link']; ?>"><?php echo $project['name']; ?></a></h3> <h3><a href="<?php echo $project['link']; ?>"><?php echo $project['name']; ?></a></h3>
<p> <p>
<?php echo $project['shortContent']; ?><br /> <?php echo $project['shortContent']; ?><br />
<span class="postInfos"><a href="/project/<?php echo $project['internalLink']; ?>">Plus d'infos.</a></span> <span class="postInfos"><a href="/project/<?php echo $project['slug']; ?>">Plus d'infos.</a></span>
</p> </p>
</article> </article>