summaryrefslogtreecommitdiff
path: root/skin/main.skin.php
blob: f44f73975920ec68601ba8b7b35db8132cd13c14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

namespace skin\main;

function index($ctx, $name, $show_cities, $cities) {
return <<<HTML
    Hello, {$name}!<br/>
    
    {$ctx->if_true($show_cities, 'line of truth<br/>')}
    {$ctx->if_not(false, $ctx->renderIfFalse, '<b>safe<b>', '<b>unsafe<b>')}
    
    <ul>
        {$ctx->for_each($cities, fn($city, $i) => $ctx->renderIndexCityItem($city, $i+1))}
    </ul>
HTML;
}

function renderIndexCityItem($ctx, $city, $index) {
return <<<HTML
    <li>{$index} {$city}</li>
HTML;
}

function renderIfFalse($ctx, $str, $unsafe_str) {
return <<<HTML
safe: $str<br/>
unsafe: $unsafe_str
HTML;
}