1 | <?php |
---|
2 | /* |
---|
3 | * General blog functions for the new 2019 "micro" blog (micro in terms of: |
---|
4 | * no to little infrastructure). |
---|
5 | * |
---|
6 | * Include this instead of "lib/technikum29.php" |
---|
7 | */ |
---|
8 | |
---|
9 | // The "seiten_id" should always be "blog" in order to trick the navigation |
---|
10 | // system for the time being. It's a workaround because I don't want to |
---|
11 | // touch the t29 navigation system but keep the "blog" link active. |
---|
12 | $seiten_id = 'blog'; |
---|
13 | $titel = $blog_title . " — in the Tube, a technikum29 blog"; |
---|
14 | |
---|
15 | $lang = "en"; // for the time being |
---|
16 | |
---|
17 | $dynamischer_inhalt = true; // at least during development |
---|
18 | |
---|
19 | require "../lib/technikum29.php"; |
---|
20 | |
---|
21 | ?> |
---|
22 | <header class="teaser seitenstart blog"> |
---|
23 | <span id="blog-heading"> |
---|
24 | <a class="title" href="/blog/">Tubes</a> |
---|
25 | <span class="subtext">A technikum29 computer museum blog</span> |
---|
26 | </span> |
---|
27 | <img class="no-copyright" src="/shared/photos/blog/blog-teaser-background-tubes.jpg" width="940" height="243"> |
---|
28 | </header> |
---|
29 | <?php |
---|
30 | |
---|
31 | function print_blog_title() { |
---|
32 | global $blog_title, $blog_date, $blog_author; |
---|
33 | ?> |
---|
34 | <h2><?php print $blog_title; ?> |
---|
35 | <span class="blog_subline">on <?php print $blog_date; ?> by <a href="#author-<?php print strtolower($blog_author); ?>"><?php print $blog_author; ?></a></span> |
---|
36 | </h2> |
---|
37 | <?php |
---|
38 | } |
---|
39 | |
---|
40 | function print_author_info() { |
---|
41 | global $blog_author, $blog_title, $blog_date; |
---|
42 | $blog_author = isset($blog_author) ? strtolower($blog_author) : Null; |
---|
43 | |
---|
44 | print_author_box($blog_author, |
---|
45 | "<h4>About the author of the blog post “${blog_title}”</h4><p>", |
---|
46 | "</p><em>Blog post written at $blog_date.</em></p>" |
---|
47 | ); |
---|
48 | } |
---|
49 | |
---|
50 | function get_author_picture_filename($blog_author) { |
---|
51 | global $webroot; // lib/technikum29.php |
---|
52 | $candidates = glob("$webroot/shared/photos/blog/blog-author-$blog_author.*"); |
---|
53 | return ($candidates && isset($candidates[0])) ? |
---|
54 | substr($candidates[0], strlen($webroot)) : Null; |
---|
55 | } |
---|
56 | |
---|
57 | function print_author_box($blog_author, $prepend_text="", $append_text="") { |
---|
58 | print "<section class='blog author_info left clear-after' id='author-$blog_author'>"; |
---|
59 | $author_picture = get_author_picture_filename($blog_author); |
---|
60 | if($author_picture) |
---|
61 | print "<a href='$author_picture' class='popup'><img src='$author_picture' alt='Photo of blog author' class='photo'></a>"; |
---|
62 | print $prepend_text; |
---|
63 | |
---|
64 | switch($blog_author) { |
---|
65 | case "sven": ?> |
---|
66 | <a href="http://svenk.org">Sven Köppel</a> is theoretical physicist with |
---|
67 | a focus on elementary particle and gravitational physics and a strong background |
---|
68 | in computational science. He is contributing to the <a href="/">technikum29 |
---|
69 | computer museum</a> since more then 15 years. |
---|
70 | <?php |
---|
71 | break; |
---|
72 | case "you": ?> |
---|
73 | <em>Probably you?</em> |
---|
74 | If you want to write something, you are very welcome to send |
---|
75 | us texts <a href="/en/contact.php">by mail</a> or to contribute directly |
---|
76 | <a href="https://github.com/technikum29/technikum29-www">via Github</a> |
---|
77 | (it <a href="https://github.blog/2012-12-05-creating-files-on-github/">is easy</a>). |
---|
78 | <?php |
---|
79 | break; |
---|
80 | default: |
---|
81 | print "<em>Error: Missing author name, please provide as <tt>blog_author</tt>.</em>"; |
---|
82 | } |
---|
83 | |
---|
84 | print $append_text; |
---|
85 | ?> |
---|
86 | </section><?php |
---|
87 | } |
---|