more dynamic header
This commit is contained in:
21
www/pages/adventofcode_day.php
Normal file
21
www/pages/adventofcode_day.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
$year = intval($ROUTE->parameter['year']);
|
||||
$day = intval($ROUTE->parameter['day']);
|
||||
|
||||
if ($SITE->modules->AdventOfCode()->getSingleDay($year, $day) === null)
|
||||
{
|
||||
$FRAME_OPTIONS->setForced404('Advent of Code not found');
|
||||
return;
|
||||
}
|
||||
|
||||
$FRAME_OPTIONS->setForcedRedirect($SITE->modules->AdventOfCode()->getSingleDay($year, $day)['url']);
|
||||
?>
|
||||
32
www/pages/adventofcode_year.php
Normal file
32
www/pages/adventofcode_year.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
require_once (__DIR__ . '/../internals/website.php');
|
||||
|
||||
/** @var PageFrameOptions $FRAME_OPTIONS */ global $FRAME_OPTIONS;
|
||||
/** @var URLRoute $ROUTE */ global $ROUTE;
|
||||
/** @var Website $SITE */ global $SITE;
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
if ($ROUTE->parameter['year'] === '')
|
||||
{
|
||||
$year = array_last($SITE->modules->AdventOfCode()->listYears());
|
||||
$FRAME_OPTIONS->setForcedRedirect($SITE->modules->AdventOfCode()->getURLForYear($year));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$year = intval($ROUTE->parameter['year']);
|
||||
|
||||
if (in_array($year, $SITE->modules->AdventOfCode()->listYears()))
|
||||
{
|
||||
$FRAME_OPTIONS->setForcedRedirect($SITE->modules->AdventOfCode()->getURLForYear($year));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$FRAME_OPTIONS->setForced404('Advent of Code not found');
|
||||
return;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -18,7 +18,7 @@ $FRAME_OPTIONS->canonical_url = $post['canonical'];
|
||||
|
||||
if ($post['type'] == 'euler')
|
||||
$FRAME_OPTIONS->activeHeader = 'euler';
|
||||
else if ($post['type'] == 'euler' && $post['issubview'])
|
||||
else if ($post['type'] == 'aoc')
|
||||
$FRAME_OPTIONS->activeHeader = 'aoc';
|
||||
else
|
||||
$FRAME_OPTIONS->activeHeader = 'blog';
|
||||
|
||||
@@ -14,7 +14,7 @@ if ($book === null) { $FRAME_OPTIONS->setForced404("Books not found"); return; }
|
||||
|
||||
$FRAME_OPTIONS->title = $book['title'];
|
||||
$FRAME_OPTIONS->canonical_url = $book['url'];
|
||||
$FRAME_OPTIONS->activeHeader = 'book';
|
||||
$FRAME_OPTIONS->activeHeader = 'books';
|
||||
|
||||
$FRAME_OPTIONS->addScript('/data/javascript/ms_basic.js', true);
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user