Example #1
0
on('GET', '/flash-set', function () {
    flash('message', 'success');
});
on('GET', '/flash-get', function () {
    echo 'message=' . flash('message');
});
on('GET', '/partial/:name', function ($name) {
    echo partial('partial', array('name' => $name));
});
on('GET', '/template/:name', function ($name) {
    render('template', array('name' => $name));
});
on('GET', '/inline', inline('inline'));
on('GET', '/inline/locals', inline('inline-locals', array('name' => 'dispatch')));
on('GET', '/inline/callback', inline('inline-locals', function () {
    return array('name' => 'dispatch');
}));
on('GET', '/session/setup', function () {
    session('name', 'i am dispatch');
    session('type', 'php framework');
});
on('GET', '/session/check', function () {
    session('type', null);
    if (session('type')) {
        echo "type is still set";
    }
    echo session('name');
});
on('POST', '/upload', function () {
    $info = upload_info('attachment');
    if (is_array($info) && is_uploaded_file($info['tmp_name'])) {
Example #2
0
<a href="<?php 
echo $last;
?>
" title="The last image">&gt;&gt;</a>
<br />
<a href="#" onclick="makevis('list');return false;">+</a>
<br /> <br />
    <div id='list'>

<?php 
while (list($x, $value) = each($imgs)) {
    printf("<a href=\"%s\">%s</a>\n", $imgs[$x], $imgs[$x]);
    printf("<a href=\"%s?image=%s\">here</a><br>\n", $_SERVER['PHP_SELF'], $imgs[$x]);
}
?>

    </div>
</div>

<div style="padding-top:20px; margin-left: 27%; margin-right: 5px;">

<?php 
if (isset($image)) {
    inline($image);
}
?>

</div>
</body>
</html>