1
0

blogview_plain

This commit is contained in:
Mike Schwörer 2017-12-30 23:11:51 +01:00
parent fb11bdca19
commit c4aa27a708
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
10 changed files with 138 additions and 5 deletions

View File

@ -204,6 +204,21 @@ html, body {
@media (max-width: 767px) {
.ble_title {
font-size: 1.25em; } }
.blogcontent {
color: #333;
border: 1px solid black;
background-color: #E0E0E0;
width: 80%;
margin-left: auto;
margin-right: auto; }
.bc_header {
background-color: #BBB;
padding: 0 4px; }
.bc_data {
padding: 8px; }
.euler_pnl_base {
display: inline-flex;
flex-direction: column;

View File

@ -4,5 +4,6 @@
@import 'styles_main';
@import 'styles_bloglist';
@import 'styles_blogview';
@import 'styles_eulerpanel';

View File

@ -0,0 +1,19 @@
@import 'styles_config';
.blogcontent {
color: $COL_TEXT_DARK;
border: 1px solid black;
background-color: $COL_BACKGROUND_2;
width: 80%;
margin-left: auto;
margin-right: auto;
}
.bc_header {
background-color: #BBB;
padding: 0 4px;
}
.bc_data {
padding: 8px;
}

View File

@ -1,5 +1,7 @@
$COL_BACKGROUND: #EEE;
$COL_BACKGROUND_2: #E0E0E0;
$COL_TEXT_NORMAL: #CCC;
$COL_TEXT_DARK: #333;
$COL_TRANSPARENT: #FFFFFF00;
$FONT_HEADER: Lato, "Helvetica Neue", Helvetica, Arial, sans-serif;

View File

@ -25,7 +25,7 @@ body {
.contentheader {
width: 100%;
color: #333;
color: $COL_TEXT_DARK;
font-size: large;
}

View File

@ -0,0 +1,16 @@
<?php
require_once (__DIR__ . '/../internals/base.php');
require_once (__DIR__ . '/../internals/blog.php');
?>
<div class="blogcontent bc_plain">
<div class="bc_header">
<?php echo $post['date']; ?>
</div>
<div class="bc_data">
<?php echo nl2br(Blog::getPostFragment($post)); ?>
</div>
</div>

View File

@ -38,11 +38,16 @@ $URL_RULES =
[ 'url' => ['msmain', 'adminEGH'], 'target' => 'pages/admin_egh.php', 'options' => [ 'commandcode' => '%GET%' ], ],
[ 'url' => ['blog'], 'target' => 'pages/blog_list.php', 'options' => [], ],
[ 'url' => ['log'], 'target' => 'pages/blog_list.php', 'options' => [], ],
[ 'url' => ['blogpost', 'index'], 'target' => 'pages/blog_list.php', 'options' => [], ],
[ 'url' => ['blog', '?{id}'], 'target' => 'pages/blog_view.php', 'options' => [ 'id' => '%URL%', 'subview' => '' ], ],
[ 'url' => ['blog', '?{id}'], 'target' => 'pages/blog_view.php', 'options' => [ 'id' => '%URL%', 'subview' => '' ], ],
[ 'url' => ['blog', '?{id}', '?{name}'], 'target' => 'pages/blog_view.php', 'options' => [ 'id' => '%URL%', 'subview' => '' ], ],
[ 'url' => ['blog', '?{id}', '?{name}', '?{subview}'], 'target' => 'pages/blog_view.php', 'options' => [ 'id' => '%URL%', 'subview' => '%URL%' ], ],
[ 'url' => ['log', '?{id}'], 'target' => 'pages/blog_view.php', 'options' => [ 'id' => '%URL%', 'subview' => '' ], ],
[ 'url' => ['log', '?{id}'], 'target' => 'pages/blog_view.php', 'options' => [ 'id' => '%URL%', 'subview' => '' ], ],
[ 'url' => ['log', '?{id}', '?{name}'], 'target' => 'pages/blog_view.php', 'options' => [ 'id' => '%URL%', 'subview' => '' ], ],
[ 'url' => ['log', '?{id}', '?{name}', '?{subview}'], 'target' => 'pages/blog_view.php', 'options' => [ 'id' => '%URL%', 'subview' => '%URL%' ], ],
[ 'url' => ['blogpost', 'view'], 'target' => 'pages/blog_view.php', 'options' => [ 'id' => '%GET%', 'subview' => '' ], ],
[ 'url' => ['highscores', 'list.php'], 'target' => 'pages/highscores_listentries.php', 'options' => [ 'gameid' => '%GET%' ], ],

View File

@ -6,9 +6,9 @@ class Blog
{
return
[
[ 'id' => 5, 'date' => '2009-04-08', 'visible' => true, 'title' => 'Beginning the log', 'fragment' => 'initial.md', 'type' => 'plain', 'cat' => 'log' ],
[ 'id' => 5, 'date' => '2009-04-08', 'visible' => true, 'title' => 'Beginning the log', 'fragment' => 'initial.md', 'type' => 'markdown', 'cat' => 'log' ],
[ 'id' => 6, 'date' => '2009-05-01', 'visible' => false, 'title' => 'Mess with the best ...', 'fragment' => 'hack.md', 'type' => 'markdown', 'cat' => 'log' ],
[ 'id' => 4, 'date' => '2009-06-22', 'visible' => true, 'title' => 'New Layout!', 'fragment' => 'newlayout.txt', 'type' => 'markdown', 'cat' => 'log' ],
[ 'id' => 4, 'date' => '2009-06-22', 'visible' => true, 'title' => 'New Layout!', 'fragment' => 'newlayout.txt', 'type' => 'plain', 'cat' => 'log' ],
[ 'id' => 10, 'date' => '2009-06-28', 'visible' => true, 'title' => '"FUN" update', 'fragment' => 'funupdate.md', 'type' => 'markdown', 'cat' => 'log' ],
[ 'id' => 11, 'date' => '2009-07-05', 'visible' => true, 'title' => 'New Download: LAN Control 2.0', 'fragment' => 'lancontrol.md', 'type' => 'markdown', 'cat' => 'log' ],
[ 'id' => 12, 'date' => '2009-09-07', 'visible' => false, 'title' => 'Airline BSOD', 'fragment' => 'bsod.md', 'type' => 'markdown', 'cat' => 'log' ],
@ -34,6 +34,19 @@ class Blog
usort($data, function($a, $b) { return strcasecmp($b['date'], $a['date']); });
return $data;
}
public static function getBlogpost($id)
{
foreach (self::listAll() as $post) {
if ($post['id'] == $id) return $post;
}
return null;
}
public static function getPostFragment($post)
{
return file_get_contents( __DIR__ . '/../statics/blog/' . $post['fragment']);
}
}

View File

@ -7,7 +7,6 @@ require_once (__DIR__ . '/../internals/blog.php');
$allposts = Blog::listAllOrderedDescending();
?>
<?php require_once (__DIR__ . '/../internals/base.php'); ?>
<head>
<meta charset="utf-8">
<title>Mikescher.com - Blog</title>

63
www/pages/blog_view.php Normal file
View File

@ -0,0 +1,63 @@
<!DOCTYPE html>
<html lang="en">
<?php
require_once (__DIR__ . '/../internals/base.php');
require_once (__DIR__ . '/../internals/blog.php');
$id = $OPTIONS['id'];
$subview = $OPTIONS['subview'];
$post = Blog::getBlogpost($id);
if ($post === NULL) httpError(404, 'blogpost not found');
?>
<head>
<meta charset="utf-8">
<title>Mikescher.com - Blog</title>
<meta name="google-site-verification" content="pZOhmjeJcQbRMNa8xRLam4dwJ2oYwMwISY1lRKreSSs"/>
<link rel="icon" type="image/png" href="/data/images/favicon.png"/>
<link rel="stylesheet" href="/data/css/styles.css"/>
</head>
<body>
<div id="mastercontainer">
<?php include (__DIR__ . '/../fragments/header.php'); ?>
<div id="content" class="content-responsive">
<div class="blockcontent">
<div class="contentheader"><h1><?php echo htmlspecialchars($post['title']); ?></h1><hr/></div>
<?php
if ($post['type'] === 'plain') {
include (__DIR__ . '/../fragments/blogview_plain.php');
} elseif ($post['type'] === 'markdown') {
include (__DIR__ . '/../fragments/blogview_markdown.php');
} elseif ($post['type'] === 'php') {
include (__DIR__ . '/../fragments/blogview_php.php');
} elseif ($post['type'] === 'euler') {
include (__DIR__ . '/../fragments/blogview_euler.php');
}
?>
</div>
</div>
<?php include (__DIR__ . '/../fragments/footer.php'); ?>
</div>
</body>
</html>