示例#1
0
<?php 
    echo kirbytext($page->text());
    ?>
            </div>
<?php 
}
?>

<?php 
if ($page->related()) {
    ?>
            <section>
                <h1>Related</h1>
                <ul>
<?php 
    foreach (related($page->related()) as $related) {
        ?>
                    <li><a href="<?php 
        echo $related->url();
        ?>
"><?php 
        echo smartypants($related->title());
        ?>
</a></li>
<?php 
    }
    ?>
                </ul>
            </section>
<?php 
}
    ?>
                </tbody>
            </table>
        </details>
<?php 
}
?>

<?php 
if ($page->route()->isNotEmpty()) {
    ?>
        <details class="related-routes">
            <summary>Routes Serving the Station</summary>
            <ul>
            <?php 
    foreach (related($page->route()) as $routes) {
        ?>
                <li><a href="<?php 
        echo $routes->url();
        ?>
"><?php 
        echo smartypants($routes->title());
        ?>
</a></li>
            <?php 
    }
    ?>
            </ul>
        </details>
<?php 
}
<?php

$n = 3;
$t = 1;
$a = '1 8 7';
$b = '3 9 2';
if (related($a, $b)) {
    echo "YES\n";
} else {
    echo "NO\n";
}
function related($a, $b)
{
    $a = explode(" ", $a);
    $b = explode(" ", $b);
    $prev = -1;
    for ($i = 0; $i < count($a); $i++) {
        $ci = minGreater($prev, $a[$i], $b[$i]);
        if ($ci === false) {
            return false;
        }
        $prev = $ci;
        echo $ci;
    }
    return true;
}
function minGreater($val, $a, $b)
{
    if ($val > $a && $val > $b) {
        return false;
    } else {
示例#4
0
                <li><a href="<?php 
            echo $item->url();
            ?>
"<?php 
            if ($item->text() == '') {
                ?>
 class="unremarkable"<?php 
            }
            ?>
><?php 
            echo smartypants($item->title());
            ?>
</a></li>
            <?php 
        } else {
            $routes = related($item->route());
            $type = 'station';
            foreach ($routes as $connection) {
                if ($connection->title() !== $page->title()) {
                    $type = 'interchange';
                }
            }
            ?>
                <li class="<?php 
            echo $type;
            ?>
">
                    <a href="<?php 
            echo $item->url();
            ?>
"><?php