2024.12.01 17:43:52

This commit is contained in:
Christian Moser 2024-12-01 17:43:52 +01:00
parent e0a88c3bd4
commit 1025cf621a
4 changed files with 32 additions and 7 deletions

View File

@ -23,8 +23,10 @@ class MainController extends WebrootController
return $this->redirectToRoute("app_login");
}
return $this->render('main/index.html.twig', [
'user' => $user,
]);
return $this->render('main/index.html.twig', array_merge(
$this->getControllerVariables(),
[
'user' => $user,
]));
}
}

View File

@ -8,8 +8,25 @@ use Symfony\Component\Routing\Attribute\Route;
abstract class WebrootController extends AbstractController
{
protected function getDefaultVariables()
public function getHeaderTitleFiglet(): ?string
{
$header_title_figlet_file = getenv("HEADER_TITLE_FIGLET");
if ($header_title_figlet_file && strlen($header_title_figlet_file)) {
$figlet_file = fopen($header_title_figlet_file,"r");
$header_figlet = fread($figlet_file, filesize($header_title_figlet_file));
fclose($figlet_file);
$title = "<div class=\"center\"><pre>"
. $header_figlet
. "</pre></div>";
return $title;
}
return null;
}
protected function getControllerVariables(): array
{
return [
"header_title_figlet" => $this->getHeaderTitleFiglet(),
];
}
}

View File

@ -14,14 +14,14 @@
<body style="margin:0px;padding:0px;">
{% block body %}
<header class="header" style="color:lightgrey;padding:0px 5px 0px 5px;margin:0px;">
{% block header %}
{% block header %}{% if header_title|default(null) %}{{ header_title|raw }}{% else %}
<div class="center"><pre>
_ _
__ _____| |__ _ __ ___ ___ | |_
\ \ /\ / / _ \ '_ \| '__/ _ \ / _ \| __|
\ V V / __/ |_) | | | (_) | (_) | |_
\_/\_/ \___|_.__/|_| \___/ \___/ \__|
</pre></div>
</pre></div>{% endif %}
{% endblock %}
</header>
<main>

6
templates/mydevel.txt Normal file
View File

@ -0,0 +1,6 @@
_ _ _
_ __ ___ _ _ __| | _____ _____| | __ _| |_
| '_ ` _ \| | | |/ _` |/ _ \ \ / / _ \ | / _` | __|
| | | | | | |_| | (_| | __/\ V / __/ || (_| | |_
|_| |_| |_|\__, |\__,_|\___| \_/ \___|_(_)__,_|\__|
|___/