Commit 2ae140cc authored by Corentin Bettiol's avatar Corentin Bettiol 💻
Browse files

change mainController & layout, add favicon, change css, add some classes,...

change mainController & layout, add favicon, change css, add some classes, work with bdd, config file
parent bc7ded60
......@@ -6,8 +6,7 @@
right: 0;
bottom: 0;
left: 0;
opacity: 0.6;
z-index: -1;
opacity: 0.4;
}
#videoFond > video {
width: 100%;
......@@ -38,14 +37,6 @@
}
}
body{
opacity: 0.75;
}
#videoFond{
opacity: 1;
}
#header{
margin-top: 0;
header, #menu{
z-index: 2;
}
\ No newline at end of file
......@@ -48,7 +48,7 @@ article p, #pageTitle, article h3, article ul{
width: auto;
margin: auto;
color: #2E2E2E;
text-shadow: 0 0 3px #6699ff;
text-shadow: 0 0 3px #69f;
}
#menu{
......@@ -64,9 +64,16 @@ h2{
}
h3{
margin-top: 5px;
font-size: 1em;
h3 a{
text-decoration: none;
text-shadow: 0 0 1px #69f;
transition: padding-left 0.3s, text-shadow 0.3s;
}
h3 a:hover{
padding-left: 5px;
text-shadow: -5px 0 4px #BBf;
transition: padding-left 0.3s, text-shadow 0.3s;
}
#listMenu{
......@@ -125,6 +132,15 @@ hr{
border: 1px solid #CFCFCF;
}
a{
transition: color 0.3s;
}
a:hover{
color: #55a;
transition: color 0.3s;
}
/*
====
......
img/icon.png

411 Bytes

<?php
require_once("site/controller/mainController.php");
require_once("site/layout/layout.php");
?>
\ No newline at end of file
<?php
function getPageName(){
switch ($_GET['action']) {
case 'contact':
return ["Contact", "contact"];
break;
case 'about':
return ["À Propos", "about"];
break;
case 'projects':
return ["Projets", "projects"];
break;
case 'changelog':
return ["Changelog", "changelog"];
break;
case 'rss':
return ["Rss", "rss"];
break;
case '404':
return ["Erreur 404 - File not found", "404"];
break;
case 'article':
return [$_GET['title'], $_GET['title']];
break;
default:
return ["Blog", "blog"];
break;
}
}
\ No newline at end of file
<?php
function writeBlogPage(){
/*
if(!empty($_GET['page']))
writeBlogArticles($_GET['page'];
else if(!empty($_GET['title']))
writeBlogArticle($_GET['title']);
else
writeBlogArticles(0);
*/
}
\ No newline at end of file
<?php
function writeMenu($pageName){
?>
<ul id="listMenu">
<li><h2><a href="/" title="Blog" <?php if($pageName == "Blog"){ ?>class="selected"<?php } ?>>Blog</a></h2></li>
<li><h2><a href="/about" title="À propos" <?php if($pageName == "À Propos"){ ?>class="selected"<?php } ?>>À propos</a></h2></li>
<li><h2><a href="/projects" title="Projets" <?php if($pageName == "Projets"){ ?>class="selected"<?php } ?>>Projets</a></h2></li>
<li><h2><a href="/contact" title="Contact" <?php if($pageName == "Contact"){ ?>class="selected"<?php } ?>>Contact</a></h2></li>
</ul>
<?php }
\ No newline at end of file
<?php
require_once("functionWriteMenu.php");
require_once("functionWriteBlogPage.php");
require_once("functionGetPageName.php");
ini_set('display_errors','on');
error_reporting(E_ALL|E_STRICT);
$pageName = getPageName();
\ No newline at end of file
require_once("site/model/config.php");
require_once("site/model/Base.php");
require_once("site/model/BlogManager.php");
require_once("site/model/ProjectsManager.php");
function getPageName(){
if(isset($_GET['action'])){
switch ($_GET['action']) {
case 'contact':
return ["Contact", "contact"];
break;
case 'about':
return ["À Propos", "about"];
break;
case 'projects':
return ["Projets", "projects"];
break;
case 'changelog':
return ["Changelog", "changelog"];
break;
case 'rss':
return ["Rss", "rss"];
break;
case '404':
return ["Erreur 404 - File not found", "404"];
break;
case 'article':
return [$_GET['title'], $_GET['title']];
break;
default:
return ["Blog", "blog"];
break;
}
}
else{
return ["Blog", "blog"];
}
}
function writeMenu($pageName){
?>
<ul id="listMenu">
<li><h2><a href="/" title="Blog" <?php if($pageName == "Blog"){ ?>class="selected"<?php } ?>>Blog</a></h2></li>
<li><h2><a href="/about" title="À propos" <?php if($pageName == "À Propos"){ ?>class="selected"<?php } ?>>À propos</a></h2></li>
<li><h2><a href="/projects" title="Projets" <?php if($pageName == "Projets"){ ?>class="selected"<?php } ?>>Projets</a></h2></li>
<li><h2><a href="/contact" title="Contact" <?php if($pageName == "Contact"){ ?>class="selected"<?php } ?>>Contact</a></h2></li>
</ul>
<?php }
function writeBlogPage($pageName){
if($pageName[1] == "blog"){
$blog = new BlogManager();
if(isset($_GET['title'])){
$title = $_GET['title'];
$blogpost = $blog->getBlogPost($title);
if($blogpost != false)
require("site/view/public/blogPostView.php");
else
header("Location:/404");
}
else{
$blogposts = $blog->getBlog();
require("site/view/public/blogView.php");
}
}
}
function writeProjectsPage($pageName){
$projects = new ProjectManager();
$listProjects = $projects->getProjects();
require("site/view/public/projectsView.php");
}
$pageName = getPageName();
......@@ -10,6 +10,7 @@
if($pageName[1] == 404){ ?>
<link rel="stylesheet" href="/css/404.css" />
<?php } ?>
<link rel="icon" type="image/png" href="img/icon.png" />
<style>
*{
color: #1f1f2e;
......@@ -32,13 +33,39 @@
</nav>
</header>
<?php require_once("site/view/". $pageName[1] .".php"); ?>
<?php switch ($pageName[1]) {
case 'blog':
writeBlogPage($pageName);
break;
case 'about':
require("site/view/public/about.php");
break;
case 'projects':
writeProjectsPage($pageName);
break;
case 'contact':
require("site/view/public/contact.php");
break;
case 'changelog':
require("site/view/public/changelog.php");
break;
case 'rss':
require("site/view/public/rss.php");
break;
case '404':
require("site/view/public/404.php");
break;
default:
# code...
break;
} ?>
<hr />
<footer id="footer">
<p>
Site créé par Corentin Bettiol - <a href="/changelog" title="changelog">Changelog</a> - <a href="/rss" title="rss">RSS</a> - v1
Site créé par Corentin Bettiol - <a href="/changelog" title="changelog">Changelog</a> - <a href="/rss" title="rss">RSS</a> - v5
</p>
</footer>
......
<?php
class Base
{
protected function dbConnect()
{
$db = new PDO('mysql:host=localhost;dbname='. dbName .';charset=utf8', dbUser, dbPass);
return $db;
}
}
\ No newline at end of file
<?php
class BlogManager extends Base
{
public function getBlog()
{
$db = $this->dbConnect();
$req = $db->query('SELECT * FROM l3m_blog ORDER BY id DESC LIMIT 0, 5');
return $req;
}
public function getBlogPost($link)
{
$link = htmlspecialchars($link);
$title = str_replace("-", " ", $link);
$db = $this->dbConnect();
$req = $db->prepare('SELECT * FROM l3m_blog WHERE title = ?');
$req->execute(array($title));
$post = $req->fetch();
if($post == false)
return false;
$post["link"] = $link;
$post['datetime'] = new DateTime($post['time']);
return $post;
}
}
\ No newline at end of file
<?php
class ProjectManager extends Base
{
public function getProjects()
{
$db = $this->dbConnect();
$req = $db->query('SELECT * FROM l3m_projects ORDER BY time DESC');
return $req;
}
}
\ No newline at end of file
<?php
// config file
// database config
define('dbName', '');
define('dbUser', '');
define('dbPass', '');
\ No newline at end of file
<article>
<p>
Désolé, ce lien est cassé, le contenu n'existe pas ou a changé d'adresse.
</p>
</article>
<div id="videoFond">
<video autoplay loop>
<source type="video/mp4" src="img/CloudsLoop.mp4" media="(orientation: landscape)">
</video>
</div>
\ No newline at end of file
<?php
writeBlogPage();
?>
<article>
<h3><a href="/article/premier-post-du-nouveau-blog">Premier post du nouveau blog</a></h3>
<p class="postInfos">
Le <time datetime="2018-09-20 14:32:49">Jeudi 20 septembre 2018 à 14h32</time> par Corentin Bettiol, pas de commentaire
</p>
<section>
<p>
Coucou, bienvenue sur cette nouvelle version du blog.
</p>
</section>
</article>
\ No newline at end of file
TODO -- projets
\ No newline at end of file
<article>
<h3>404 - Page not found</h3>
<p>
Ce lien est cassé.
</p>
<p>
Le contenu n'existe pas ou a changé d'adresse, ou alors vous vous amusez avec les url. Dans les deux cas il n'y a rien à trouver ici.
</p>
</article>
<div id="videoFond">
<video autoplay loop>
<source type="video/mp4" src="/img/CloudsLoop.mp4" media="(orientation: landscape)">
</video>
</div>
\ No newline at end of file
<article>
<h3><a href="/article/<?php echo $blogpost['link']; ?>"><?php echo $blogpost['title']; ?></a></h3>
<p class="postInfos">
Le <time datetime="<?php echo $blogpost['time']; ?>"><?php echo date_format($blogpost['datetime'], 'd/m/Y à H:i'); ?></time>, pas de commentaire
</p>
<section>
<p>
<?php echo $blogpost['content']; ?>
</p>
</section>
</article>
\ No newline at end of file
<?php
if($blogposts == false){
?>
<article>
<h3>Pas de post</h3>
<p>Aucun billet n'a encore été publié, patience !</p>
</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
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