summaryrefslogtreecommitdiff
path: root/lib/Skin.php
blob: e04aa5b73224f77576527ec648ae65fd5c963c48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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,
        );
    }

}