summaryrefslogtreecommitdiff
path: root/lib/Skin.php
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-07-07 20:31:22 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-07-07 20:31:22 +0300
commit6c081f3aff64689ed3b77bfeec1d2e0005fe5286 (patch)
treeceaeb1c9b235a7f701039d11da145bd18ae98be3 /lib/Skin.php
initial
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,
+ );
+ }
+
+}