Blog und Events sind jetzt getrennt, Blog ist
soweit funktionell und README wurde aktualisiert.
This commit is contained in:
parent
5dd4e6ad65
commit
1944320a50
26
README.MD
26
README.MD
|
@ -22,20 +22,22 @@
|
|||
Datei im Eventverzeichnis Anlegen: *YYYY-MM-DD.html*
|
||||
|
||||
```
|
||||
title: Event Titel
|
||||
date: Event Datum
|
||||
desc: Event Beschreibung
|
||||
Blogpost Titel
|
||||
Blogpost Beschreibung
|
||||
Blogpost Datum
|
||||
Blogpost Autor
|
||||
------------------------
|
||||
#Content below here!
|
||||
# Content below here!
|
||||
```
|
||||
|
||||
Strukturierung:
|
||||
|
||||
- Header
|
||||
```
|
||||
title: Event Titel
|
||||
date: Event Datum
|
||||
desc: Event Beschreibung
|
||||
Blogpost Titel
|
||||
Blogpost Beschreibung
|
||||
Blogpost Datum
|
||||
Blogpost Autor
|
||||
```
|
||||
|
||||
- Trenner zwischen Header und Content
|
||||
|
@ -43,15 +45,13 @@ desc: Event Beschreibung
|
|||
------------------------
|
||||
```
|
||||
|
||||
- Kommentar
|
||||
- Content
|
||||
```
|
||||
#Content below here!
|
||||
# Content below here!
|
||||
```
|
||||
|
||||
Unter dem Trenner kann HTML verwendet werden.
|
||||
Unter dem Trenner kann Markdown verwendet werden.
|
||||
|
||||
Eigenes CSS kann in der Datei *events_custom.css* hinzugefügt werden.
|
||||
|
||||
Neue Bilder kommen in das Verzeichnis */images/*
|
||||
Bilder für Posts kommen in das Verzeichnis */images/posts/*
|
||||
|
||||
[Event Dokumentation](https://git.ctdo.de/xoy/ctdo.de/src/branch/master/EVENT.MD)
|
|
@ -0,0 +1,4 @@
|
|||
img {
|
||||
display: block;
|
||||
margin: auto;
|
||||
}
|
|
@ -16,7 +16,17 @@ div.eventblock a:hover {
|
|||
}
|
||||
|
||||
div.eventblock h3 {
|
||||
right: 10px;
|
||||
top: 0;
|
||||
position: absolute;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
div.eventblock h3.a {
|
||||
text-align: left;
|
||||
width: 50%;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
div.eventblock h3.b {
|
||||
text-align: right;
|
||||
width: 50%;
|
||||
display: inline-block;
|
||||
}
|
|
@ -183,7 +183,7 @@ a.green-text {
|
|||
nav ul li {
|
||||
display: block;
|
||||
font-size: 200%;
|
||||
padding: 20px 20px 20px 0;
|
||||
padding: 30px 100px 30px 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
Weihnachten
|
||||
Weihnachten halt.
|
||||
------------------------
|
||||
# Weihnachten
|
||||
|
||||
Ist halt Weihnachten.
|
Binary file not shown.
After Width: | Height: | Size: 49 KiB |
40
index.php
40
index.php
|
@ -30,8 +30,8 @@ $nextevents = $twig_templates->render('nextevents.html.twig');
|
|||
$raumstatus_b = $util->raumstatus();
|
||||
$raumstatus = '<b>unbekannt</b>';
|
||||
|
||||
$pages = array('index', 'about', 'treff', 'events', 'kontakt', 'support', 'verein');
|
||||
$page_names = array('index', 'über uns', 'zeiten & location', 'events', 'kontakt', 'support', 'verein');
|
||||
$pages = array('index', 'about', 'treff', 'blog', 'events', 'kontakt', 'support', 'verein');
|
||||
$page_names = array('index', 'über uns', 'zeiten & location', 'blog', 'events', 'kontakt', 'support', 'verein');
|
||||
|
||||
$active_page = '';
|
||||
|
||||
|
@ -42,13 +42,26 @@ if(gettype($raumstatus_b) == "boolean") {
|
|||
$raumstatus = $util->html_link('https://status.ctdo.de/', 'red-text', '<b>geschlossen</b>', TRUE);
|
||||
}
|
||||
|
||||
$topic = $util->get_next_topic();
|
||||
switch ($topic->days) {
|
||||
case 0:
|
||||
$topic_output = '<p class="topic">Der nächste Topictreff findet heute statt!</p>';
|
||||
break;
|
||||
case 1:
|
||||
$topic_output = '<p class="topic">Der nächste Topictreff findet morgen statt!</p>';
|
||||
break;
|
||||
default:
|
||||
$topic_output = '<p class="topic">Der nächste Topictreff findet in '.$topic->days.' Tagen ['.$topic->date.'] statt.</p>';
|
||||
break;
|
||||
}
|
||||
|
||||
if(isset($_GET['page'])) {
|
||||
$page = $_GET['page'];
|
||||
$active_page = $util->str_mass_replace(array('adresse', 'irc', 'mail'), array('kontakt', 'kontakt', 'kontakt'), $page);
|
||||
$title = $page_names[array_search($active_page, $pages)];
|
||||
switch ($page) {
|
||||
case 'index':
|
||||
$content = $twig_pages->render('index.html.twig');
|
||||
$content = $twig_pages->render('index.html.twig', [ 'topic' => $topic_output, 'posts' => $util->generate_post_list(4) ]);
|
||||
$head = $util->css_link('css/main.css').$util->css_link('css/home.css').$util->css_link('css/events.css');
|
||||
break;
|
||||
case 'about':
|
||||
|
@ -59,13 +72,22 @@ if(isset($_GET['page'])) {
|
|||
$content = $twig_pages->render('treff.html.twig');
|
||||
$head = $util->css_link('css/main.css');
|
||||
break;
|
||||
case 'events':
|
||||
if(!isset($_GET['e'])) {
|
||||
$content = $twig_pages->render('events.html.twig', [ 'events' => $util->generate_event_list() ]);
|
||||
case 'blog':
|
||||
if(!isset($_GET['id'])) {
|
||||
$content = $twig_pages->render('blog.html.twig', [ 'posts' => $util->generate_post_list() ]);
|
||||
$head = $util->css_link('css/main.css').$util->css_link('css/events.css');
|
||||
} else {
|
||||
$content = $converter->convert($util->get_event_content($_GET['e']));
|
||||
$head = $util->css_link('css/main.css');
|
||||
$content = $converter->convert($util->get_post_content($_GET['id']));
|
||||
$head = $util->css_link('css/main.css').$util->css_link('css/event.css');
|
||||
}
|
||||
break;
|
||||
case 'events':
|
||||
if(!isset($_GET['e'])) {
|
||||
$content = $twig_pages->render('events.html.twig', [ 'topic' => $topic_output, 'events' => $util->generate_post_list() ]);
|
||||
$head = $util->css_link('css/main.css').$util->css_link('css/events.css');
|
||||
} else {
|
||||
$content = $converter->convert($util->get_post_content($_GET['e']));
|
||||
$head = $util->css_link('css/main.css').$util->css_link('css/event.css');
|
||||
}
|
||||
break;
|
||||
case 'kontakt':
|
||||
|
@ -113,7 +135,7 @@ if(isset($_GET['page'])) {
|
|||
} else {
|
||||
$active_page = 'index';
|
||||
$title = $active_page;
|
||||
$content = $twig_pages->render('index.html.twig');
|
||||
$content = $twig_pages->render('index.html.twig', [ 'topic' => $topic_output, 'posts' => $util->generate_post_list(4) ]);
|
||||
$head = $util->css_link('css/main.css').$util->css_link('css/home.css').$util->css_link('css/events.css');
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
<h1>Blog</h1>
|
||||
{{ posts | raw }}
|
|
@ -1,3 +1,3 @@
|
|||
<h1>Events</h1>
|
||||
!TOPICTREFF
|
||||
{{ topic | raw }}
|
||||
{{ events | raw }}
|
|
@ -12,4 +12,6 @@
|
|||
Wenn du mehr über uns wissen möchtest, schau hier: <a href="/?page=about">über uns</a>
|
||||
</p>
|
||||
|
||||
<h2>Die nächsten Events</h2>
|
||||
<h2>Die nächsten Events</h2>
|
||||
{{ topic | raw }}
|
||||
{{ posts | raw }}
|
55
php/util.php
55
php/util.php
|
@ -38,33 +38,47 @@ class Util {
|
|||
return $string;
|
||||
}
|
||||
|
||||
function scan_for_events() {
|
||||
$s = scandir('events/');
|
||||
function scan_for_posts() {
|
||||
$s = scandir(__DIR__ . '/../posts/', SCANDIR_SORT_DESCENDING);
|
||||
$output = array();
|
||||
foreach ($s as $f) {
|
||||
if(count(str_split($f)) == 13)
|
||||
if(count(str_split($f)) >= 4)
|
||||
$output[] = $f;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function generate_event_list() {
|
||||
$events = $this->scan_for_events();
|
||||
function generate_post_list($limit = -1) {
|
||||
$events = $this->scan_for_posts();
|
||||
$output = "";
|
||||
foreach ($events as $event) {
|
||||
$date = str_replace('.md', '', $event);
|
||||
$lines = file(__DIR__ . '/../events/' . $event);
|
||||
$title = $lines[0];
|
||||
$desc = $lines[1];
|
||||
$output .= '<div class="eventblock"><h3>'.$date.'</h3><a href="?page=events&e='.$date.'"><h2>'.$title.'</h2><p>'.$desc.'</p></a></div>';
|
||||
if ($limit == -1) {
|
||||
foreach ($events as $event) {
|
||||
$lines = file(__DIR__ . '/../posts/' . $event);
|
||||
$title = $lines[0];
|
||||
$desc = $lines[1];
|
||||
$date = $lines[2];
|
||||
$signatur = $lines[3];
|
||||
$output .= '<div class="eventblock"><h3>'.$signatur.'<br>'.$date.'</h3><a href="?page=blog&id='.str_replace('.md', '', $event).'"><h2>'.$title.'</h2><p>'.$desc.'</p></a></div>';
|
||||
}
|
||||
} else {
|
||||
if($limit > count($events))
|
||||
$limit = count($events);
|
||||
for ($i = 0; $i < $limit; $i++) {
|
||||
$lines = file(__DIR__ . '/../posts/' . $events[$i]);
|
||||
$title = $lines[0];
|
||||
$desc = $lines[1];
|
||||
$date = $lines[2];
|
||||
$signatur = $lines[3];
|
||||
$output .= '<div class="eventblock"><h3 class="a">'.$signatur.'</h3><h3 class="b">'.$date.'</h3><a href="?page=blog&id='.str_replace('.md', '', $event).'"><h2>'.$title.'</h2><p>'.$desc.'</p></a></div>';
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function get_event_content($date) {
|
||||
$lines = file(__DIR__ . '/../events/' . $date . '.md');
|
||||
function get_post_content($id) {
|
||||
$lines = file(__DIR__ . '/../posts/' . str_replace('.', '', $id) . '.md');
|
||||
$output = "";
|
||||
for ($i = 3; $i < count($lines); $i++)
|
||||
for ($i = 5; $i < count($lines); $i++)
|
||||
$output .= $lines[$i] . "\n";
|
||||
return $output;
|
||||
}
|
||||
|
@ -73,15 +87,14 @@ class Util {
|
|||
$output = new stdClass();
|
||||
$currentDate = new DateTime();
|
||||
|
||||
// Find the next fourth Tuesday
|
||||
$nextFourthTuesday = clone $currentDate;
|
||||
$nextFourthTuesday->modify('next Tuesday')->modify('next Tuesday')->modify('next Tuesday');
|
||||
while ($nextFourthTuesday->format('N') !== '2') {
|
||||
$nextFourthTuesday->add(new DateInterval('P1D'));
|
||||
$next_topic = clone $currentDate;
|
||||
$next_topic->modify('second Tuesday of this month +1 week');
|
||||
while ($next_topic->format('N') !== '2') {
|
||||
$next_topic->add(new DateInterval('P1D'));
|
||||
}
|
||||
|
||||
$output->days = $currentDate->diff($nextFourthTuesday)->days+1;
|
||||
$output->date = $nextFourthTuesday->format('Y-m-d');
|
||||
$output->days = $currentDate->diff($next_topic)->days+1;
|
||||
$output->date = $next_topic->format('Y-m-d');
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
ChaosBrunch am Sonntag, 02.04.2023
|
||||
Alle zwei Wochen an einem Sonntag lädt der CTDO zum Mitbring-Brunch in seinen Räume im Kulturzentrum „Langer August“ ein!
|
||||
2023-05-01
|
||||
starcalc
|
||||
------------------------
|
||||
# ChaosBrunch am Sonntag, 02.04.2023
|
||||
|
||||
Alle zwei Wochen an einem Sonntag lädt der CTDO zum **Mitbring-Brunch** in seinen Räume im Kulturzentrum „[Langer August](/?page=treff)“ ein!
|
||||
|
||||
Um **ca. 11 Uhr** geht es los, das Ende ist wie immer offen. Die Details dazu gibt es im [ctdo wiki](https://wiki.ctdo.de/events/hackerbrunch)!
|
||||
|
||||
Schaut einfach vorab im (MitbringPad)[https://md.ctdo.de/brunch] rein und kündigt an was ihr auf den Tisch werft, alles kann, nichts muss!
|
||||
|
||||
Es sind sowohl alte als auch neue Menschen gerne gesehen! Bringt was zu futtern, euer aktuelles Projekt, beides oder einfach nur Neugierde mit!
|
|
@ -0,0 +1,14 @@
|
|||
Bunt, Bunter, Chaostreff Dortmund
|
||||
Wir öffnen unsere Türen und laden Euch herzlich in unseren Chaostreff im Langen August ein.
|
||||
2023-05-02
|
||||
Fisch
|
||||
------------------------
|
||||
# Bunt, Bunter, Chaostreff Dortmundchten
|
||||
|
||||
![DORTBUND](/images/events/DORTBUNT.nebenan_Banner-fuer-Anmeldende-768x154.png)
|
||||
|
||||
Wir öffnen unsere Türen und laden Euch herzlich in unseren Chaostreff im [Langen August](/?page=treff) ein.
|
||||
|
||||
Am 5. und 6. Mai zwischen 14 und 20 Uhr könnt ihr einfach vorbeikommen und erhaltet einen Einblick in unseren Space, unsere Vereinsräume mitsamt allen Werkstätten. Um das ganze netter zu gestalten, gibt es kalte Getränke, Waffeln und auch der Grill wird angemacht.
|
||||
|
||||
Wir freuen uns auf Euch, egal ob jung, alt, groß, klein, laut oder leise. Hauptsache bunt!
|
|
@ -4,4 +4,4 @@ require __DIR__ . '/php/util.php';
|
|||
|
||||
$u = new Util();
|
||||
|
||||
echo var_dump($u->get_next_topic());
|
||||
echo var_dump($u->scan_for_posts());
|
Loading…
Reference in New Issue