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

change blog & project views, it's working now

parent d38afd22
......@@ -79,8 +79,7 @@ function writeBlogPage($pageName){
function writeProjectsPage($pageName){
$projects = new ProjectManager();
$listProjects = $projects->getProjects();
$projects = $projects->getProjects();
require("site/view/public/projectsView.php");
}
......
......@@ -7,10 +7,9 @@ class BlogManager extends Base
$stop = $start + 5;
$db = $this->dbConnect();
$req = $db->prepare('SELECT * FROM l3m_blog ORDER BY id DESC LIMIT '. $start .', '. $stop .'');
$posts = $req->fetch();
$req = $db->query('SELECT * FROM l3m_blog ORDER BY id DESC LIMIT '. $start .', '. $stop .'');
return $posts;
return $req;
}
public function getBlogPost($link)
......
......@@ -4,7 +4,7 @@ class ProjectManager extends Base
public function getProjects()
{
$db = $this->dbConnect();
$req = $db->query('SELECT * FROM l3m_projects ORDER BY time DESC');
$req = $db->query('SELECT * FROM l3m_projects ORDER BY id DESC');
return $req;
}
......
<?php
if($blogposts == false){
$hr = false;
foreach ($blogposts as $blogpost){
$blogpost['link'] = str_replace(" ", "-", $blogpost['title']);
if(!$hr)
$hr = true;
else
echo "<hr />";
$blogpost['datetime'] = new DateTime($blogpost['time']);
include("site/view/public/blogPostView.php");
}
if(!$hr){
?>
<article>
<h3>Pas de post</h3>
......@@ -8,18 +19,5 @@
</article>
<?php
}
else{
$hr = false;
foreach ($blogposts as $blogpost){
$blogpost['link'] = str_replace(" ", "-", $blogpost['title']);
if(!$hr)
$hr = true;
else
echo "<hr />";
$blogpost['datetime'] = new DateTime($blogpost['time']);
include("site/view/public/blogPostView.php");
}
}
?>
\ No newline at end of file
<?php
if($listProjects == false){
$hr = false;
foreach ($projects as $project){
if(!$hr)
$hr = true;
else
echo "<hr />";
?>
<article>
<h3><a href="<?php echo $project['link']; ?>"><?php echo $project['name']; ?></a></h3>
<p>
<?php echo $project['content']; ?>
</p>
</article>
<?php
}
if(!$hr){
?>
<article>
<h3>Pas de projet</h3>
<p>Aucun projet n'a été encore ajouté, patience !</p>
</article>
<?php
}
else{
foreach ($listProjects as $project) {
echo "<pre>";
var_dump($project);
echo "</pre>";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment