summaryrefslogtreecommitdiff
path: root/lib/Skin.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Skin.php')
-rw-r--r--lib/Skin.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/Skin.php b/lib/Skin.php
new file mode 100644
index 0000000..e04aa5b
--- /dev/null
+++ b/lib/Skin.php
@@ -0,0 +1,19 @@
+<?php
+
+class Skin {
+
+ public string $title = 'no title';
+
+ public function renderPage($f, ...$vars): string {
+ $f = str_replace('/', '\\', $f);
+ $ctx = new SkinContext(substr($f, 0, ($pos = strrpos($f, '\\'))));
+ $body = call_user_func_array([$ctx, substr($f, $pos+1)], $vars);
+
+ $layout_ctx = new SkinContext('base');
+ return $layout_ctx->layout(
+ title: $this->title,
+ unsafe_body: $body,
+ );
+ }
+
+}