Skip to content

Instantly share code, notes, and snippets.

@pateketrueke
Created May 28, 2012 05:45
Show Gist options
  • Save pateketrueke/2817493 to your computer and use it in GitHub Desktop.
Save pateketrueke/2817493 to your computer and use it in GitHub Desktop.
Example loading through the Composer to run tetl:::PHP
<?php
require 'vendor/tetlphp/framework/initialize.php';
import('www');
run(function () {
root(function () {
echo 'Hello ', link_to('World', url_for::some_action());
});
get('/some(/*what)', function () {
$links[] = url_for(ROOT);
$links[] = url_for::some('luck');
$links[] = url_for::some('WTF');
$links[] = url_for::some_hell_yeah('#!/!!!asdfgjh');
$links[] = url_for('some/thing/to/say');
$links[] = url_for('it\'s a trap!');
$pick = function ($arr) {
shuffle($arr);
return array_pop($arr);
};
$link = $pick($links);
echo 'That "', strtr(params('what'), '/', ' '), '" ', link_to('back', $link), '!';
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment