From 5c5d65d3de6b46952ac8b72fcce48292fa45e47c Mon Sep 17 00:00:00 2001 From: Ben Harris Date: Mon, 27 Jun 2016 20:29:36 -0400 Subject: [PATCH] :like: --- serv.bat | 1 + web/controllers/blog.php | 4 ++++ web/views/blog/blog.twig | 4 ++++ web/views/blog/info.twig | 19 ------------------- web/views/blog/posts/first-post.md | 2 +- web/views/blog/posts/hello-world.md | 4 ++-- 6 files changed, 12 insertions(+), 22 deletions(-) create mode 100644 serv.bat delete mode 100644 web/views/blog/info.twig diff --git a/serv.bat b/serv.bat new file mode 100644 index 0000000..9cfb0f9 --- /dev/null +++ b/serv.bat @@ -0,0 +1 @@ +php -S localhost:9000 -t web web/index.php diff --git a/web/controllers/blog.php b/web/controllers/blog.php index 8328abf..a2f524b 100644 --- a/web/controllers/blog.php +++ b/web/controllers/blog.php @@ -12,6 +12,10 @@ $blog->get('/', function() use($app, $blogposts) { $blog->get('/{slug}/', function($slug) use($app, $blogposts) { if(empty($blogposts[$slug])){ + return $app['twig']->render('blog/blog.twig', + ['alert' => 'Blog post not found. You may have a typo in your URL.', + 'posts' => $blogposts] + ); return $app['twig']->render('blog/info.twig', ['alert' => 'Blog post not found. You may have a typo in your URL.'] ); diff --git a/web/views/blog/blog.twig b/web/views/blog/blog.twig index 1615310..f71e8ef 100644 --- a/web/views/blog/blog.twig +++ b/web/views/blog/blog.twig @@ -20,6 +20,10 @@ Ben Harris + {% if alert is defined %} + + {% endif %} + {% for slug, post in posts %} {# #}

diff --git a/web/views/blog/info.twig b/web/views/blog/info.twig deleted file mode 100644 index 03e9c79..0000000 --- a/web/views/blog/info.twig +++ /dev/null @@ -1,19 +0,0 @@ -{% extends "layout.html" %} - -{% block title %}Blog | Ben Harris{% endblock %} - -{% block header %} - {{ parent() }} - -{% endblock %} - -{% block content %} - -
- - -
- -{% endblock %} diff --git a/web/views/blog/posts/first-post.md b/web/views/blog/posts/first-post.md index 2d6258c..8548a68 100644 --- a/web/views/blog/posts/first-post.md +++ b/web/views/blog/posts/first-post.md @@ -1,5 +1,5 @@ --- -title: first post +title: My First Post author: Ben Harris publish_date: Today --- diff --git a/web/views/blog/posts/hello-world.md b/web/views/blog/posts/hello-world.md index 9648649..eee0655 100644 --- a/web/views/blog/posts/hello-world.md +++ b/web/views/blog/posts/hello-world.md @@ -1,11 +1,11 @@ --- title: Hello World author: Ben Harris -publish_date: Yesterday +publish_date: 2016-06-24 --- # Hello world -_BOLD_ +__BOLD__ *THANKS* > How are you today Lorem ipsum dolor sit amet, consectetur adipisicing elit. Atque impedit assumenda qui fugit doloremque architecto placeat eum rem. Ratione harum repellat mollitia, unde fugit architecto explicabo amet. Consectetur, totam, voluptas. \ No newline at end of file